1 " ***********************************************************
  2 " *                                                         *
  3 " * Copyright, (C) Honeywell Bull Inc., 1988                *
  4 " *                                                         *
  5 " * Copyright, (C) Honeywell Information Systems Inc., 1982 *
  6 " *                                                         *
  7 " * Copyright (c) 1972 by Massachusetts Institute of        *
  8 " * Technology and Honeywell Information Systems, Inc.      *
  9 " *                                                         *
 10 " ***********************************************************
 11 
 12 " HISTORY COMMENTS:
 13 "  1) change(86-10-01,JRGray), approve(86-10-01,MCR7507),
 14 "     audit(86-10-27,RWaters), install(86-11-12,MR12.0-1202):
 15 "     Modified to allow for joining information to the definition section.
 16 "                                                      END HISTORY COMMENTS
 17 
 18 
 19 name                          object_
 20 "Original programmer:         Nate Adleman???
 21 "Language:                    alm
 22 "Translated by                Richard H. Gumpertz
 23 "Last modified on 11/12/72    by R. F. Mabee
 24 "                             11 Nov 1972 by R. F. Mabee to fix short return
 25 "                             26 Sept 1970 by RHG to add name pseudo-op
 26 "                             17 Sept 1970 at 0115 by RHG for new listing package
 27 "                             11 August 1970 at 0543 by RHG--total rewrite for new scratch segment layout
 28 "^L
 29 %include segnfo
 30 "^L
 31 "The text data words are written directly into the object segment.
 32 "The remaining data and relocation information is written into the scratch segment.
 33 
 34 "The scratch segment is accessed by the use of two pl1 type overlays.
 35 "Note that text_overlay fits into the padding of link_and_sym_overlay.
 36 
 37 
 38 
 39 "First the overlay used in writing the text relocation bits:
 40 "          dcl 1 text_overlay based ( addrel (eb_data_$segnfo.scrtch, 2*pc) ),
 41 "              2 pad bit (9),
 42 "              2 text_left_reloc bit (9),
 43 "              2 pad bit (9),
 44 "              2 text_right,reloc bit (9);
 45 
 46 "Now the overlay used in writing the link and symbol data words and relocation bits:
 47 "          dcl 1 link_and_sym_overlay based( addrel (eb_data_$segnofo.scrtch, 8*pc) ),
 48 "              2 link_left_reloc bit(9),
 49 "              2 pad bit(9),
 50 "              2 link_right_reloc bit(9),
 51 "              2 pad bit(9),
 52 "              2 link_data_word bit(36),
 53 "              2 sym_left_reloc bit(9),
 54 "              2 pad bit (9),
 55 "              2 sym_right_reloc bit(9)
 56 "              2 pad bit(9)
 57 "              2 sym_data_word bit(36),
 58 "              2 def_left_reloc bit(9),
 59 "              2 pad bit (9),
 60 "              2 def_right_reloc bit(9),
 61 "              2 pad bit(9),
 62 "              2 def_data_word bit(36);
 63 "^L
 64 "The following entries write the object words into various segments.
 65 "Calls are of the format:
 66 "         call obj___(pc,word)
 67 "         where word is the word to be written.
 68 
 69 
 70 
 71 
 72 "The following entry writes the text object words:
 73           entry      object_
 74 object_:
 75           lda        ap|2,*     get the program counter
 76           ldq        segnfo+text,*al     look at the current object word
 77           tnz        <prnter_>|[phsmsg]  if non-zero, we probably have a phase error in the object segment
 78           ldq        ap|4,*     get word to be written
 79           stq        segnfo+text,*al   write it
 80 exit:
 81           short_return
 82 
 83 
 84 
 85 
 86 "The following entry writes the link object words:
 87           entry     objlk
 88 objlk:
 89           lda       ap|2,*     get the pc
 90           als       3          multiply it by 8
 91 objwri:   eppbp     segnfo+scrtch,*al    do the addrel in the structure link_and_sym_overlay
 92           ldq       bp|1       look at current object word
 93           tnz       <prnter_>|[phsmsg]   if non-zero, we probably have a phase error
 94           ldq       ap|4,*     get the word to be written
 95           stq       bp|1       write it
 96           tra       exit-*,ic and return
 97 
 98 
 99 
100 
101 "The following entry writes the symbol table object words:
102           entry     objst
103 objst:
104           lda       ap|2,*  get the pc
105           als       3         multiply by 8
106           ada       =2,dl     add offset to indicate symbol data word
107           tra       objwri-*,ic         and join objik to write
108 
109 "The following entry writes the definition object words:
110           entry     objdf
111 objdf:
112           lda       ap|2,*  get the pc
113           als       3         multiply by 8
114           ada       =4,dl     add offset to indicate definition data word
115           tra       objwri-*,ic         and join objik to write
116 "^L
117 "The following entries read a word from the linkage or symbol table object segments.
118 "Calls are of the format:
119 "           call geto__(pc,word)
120 "           where word is the variable in which the value is to be returned.
121 
122 
123 
124 
125 "The following entry reads a word from the linkage object segment
126           entry     getolk
127 getolk:
128           lda       ap|2,*   get the pc
129           als       3        multiply it by 8
130 objrea:   eppbp     segnfo+scrtch,*al   do the addrel in the structure link_and_sym_overlay
131           ldq       bp|1     get the object word
132           stq       ap|4,*   return it into the second argument
133           tra       exit-*,ic and return
134 
135 
136 
137 
138 "The following entry reads a word from the symbol table object segment:
139           entry     getost
140 getost:
141           lda       ap|2,*      get the pc
142           als       3           multiply it by 8
143           ada       =2,dl       add offset to indicate symbol data word
144           tra       objrea-*,ic            continue as above
145 
146 "The following entry reads a word from the definition object segment:
147           entry     getodf
148 getodf:
149           lda       ap|2,*      get the pc
150           als       3           multiply it by 8
151           ada       =4,dl       add offset to indicate definition data word
152           tra       objrea-*,ic            continue as above
153 "^L
154 "The following entries write the relocation bits to the text, linkage, or symbol relocation words
155 "Calls are of the format:
156 "         call wrb_(pc,relwrd)
157 "         where relwrd contains lbits in its left half and rbits in its right half.
158 
159 
160 
161 
162 "The following entry writes the text relocation information.
163           entry     wrbtx
164 wrbtx:
165           lda       ap|2,*    get the pc
166           als       1         multiply it by 2
167           eppbp     segnfo+scrtch,*al   do the addrel in the structure text_overlay
168           ldq       ap|4,*    get the word to be written
169           stbq      bp|0,ic*  actually 24 modifier -- store the bits in the two subfields
170           tra       exit-*,ic and return
171 
172 
173 
174 
175 "The following entry writes the linkage relocation information.
176           entry     wrblk
177 wrblk:
178           lda       ap|2,*    get the pc
179           als       3         multiply by 8
180 relwri:   eppbp     segnfo+scrtch,*al   do the addrel in the structure link_and_sym_overlay
181           ldq       ap|4,*    get the word to be written
182           qls       9         position it
183           stbq      bp|0,ci   actually 50 modifier -- store the bits in the two subfields
184           tra       exit-*,ic and return
185 
186 
187 
188 
189 "The following entry writes the symbol relocation information.
190           entry     wrbst
191 wrbst:
192           lda       ap|2,*     get the pc
193           als       3         multiply by 8
194           ada       =2,dl      add offset to indicate symbol bits
195           tra       relwri-*,ic          join wrblk to write
196 
197 "The following entry writes the definition relocation information.
198           entry     wrbdf
199 wrbdf:
200           lda       ap|2,*     get the pc
201           als       3         multiply by 8
202           ada       =4,dl      add offset to indicate definition bits
203           tra       relwri-*,ic          join wrblk to write
204 "^L
205 "The following entries read the relocation bits for the text, linkage, or symbol table.
206 "Calls are of the format:
207 "         call getb__(pc,lbits,rbits)
208 
209 
210 
211 
212 "The following entry gets the text relocation bits:
213           entry     getbtx
214 getbtx:
215           lda       ap|2,*    get the pc
216           als       1         multiply by 2
217           lda       segnfo+scrtch,*al get the word we want
218           lrl       18        position the bit fields
219 relrea1:  qrl       18        "                 "
220           anaq      mask      mask out the unwanted bits
221           sta       ap|4,*    return left_bits
222           stq       ap|6,*    return right_bits
223           tra       exit-*,ic and return
224 
225 
226 
227 
228 "The following entry gets the link relocation bits:
229           entry     gtblk
230 gtblk:
231           lda       ap|2,*    get the pc
232           als       3         multiply it by 8
233 relrea2:  lda       segnfo+scrtch,*al   get the word we want
234           lrl       27        position the bit fields
235           tra       relrea1-*,ic       and join getbtx to get the bits
236 
237 
238 
239 
240 
241 "The following entry gets the symbol relocation bits.
242           entry     getbst
243 getbst:
244           lda       ap|2,*     get the pc
245           als       3         multiply by 8
246           ada       =2,dl      add offset to indicate symbol bits
247           tra       relrea2-*,ic         and join gtblk to get the bits
248 
249 
250 "The following entry gets the definition relocation bits.
251           entry     getbdf
252 getbdf:
253           lda       ap|2,*     get the pc
254           als       3         multiply by 8
255           ada       =4,dl      add offset to indicate definition bits
256           tra       relrea2-*,ic         and join gtblk to get the bits
257 
258 
259 
260           even                force us to an even boundary for the anaq
261 mask:     oct       777,777   this is the mask for recovering the relocation bits
262 "^L
263           end