Imported Upstream version 2.9.0
[debian/cc1111] / as / doc / format.txt
1         2.5.1  Object Module Format 
2
3
4            The  first  line  of  an object module contains the [XDQ][HL]
5         format specifier (i.e.  XH indicates  a  hexidecimal  file  with
6         most significant byte first) for the following designators.  
7
8
9         2.5.2  Header Line 
10
11                 H aa areas gg global symbols 
12
13            The  header  line  specifies  the number of areas(aa) and the
14         number of global symbols(gg) defined or referenced in  this  ob-
15         ject module segment.  
16
17
18         2.5.3  Module Line 
19
20                 M name 
21
22            The  module  line  specifies  the module name from which this
23         header segment was assembled.  The module line will  not  appear
24         if the .module directive was not used in the source program.  
25
26
27         2.5.4  Symbol Line 
28
29                 S string Defnnnn 
30
31                         or 
32
33                 S string Refnnnn 
34
35            The  symbol line defines (Def) or references (Ref) the symbol
36         'string' with the value nnnn.  The defined value is relative  to
37         the  current  area  base  address.   References to constants and
38         external global symbols will always appear before the first area
39         definition.  References to external symbols will have a value of
40         zero.  
41
42
43         2.5.5  Area Line 
44
45                 A label size ss flags ff 
46
47            The  area  line  defines the area label, the size (ss) of the
48         area in bytes, and the area flags (ff).  The area flags  specify
49         the ABS, REL, CON, OVR, and PAG parameters:  
50
51                 OVR/CON  (0x04/0x00 i.e.  bit position 2) 
52
53                 ABS/REL  (0x08/0x00 i.e.  bit position 3) 
54
55                 PAG      (0x10 i.e.  bit position 4) 
56
57
58         2.5.6  T Line 
59
60                 T xx xx nn nn nn nn nn ...  
61
62            The  T  line contains the assembled code output by the assem-
63         bler with xx xx being the offset address from the  current  area
64         base address and nn being the assembled instructions and data in
65         byte format.  
66
67
68         2.5.7  R Line 
69
70                 R 0 0 nn nn n1 [n1x]  n2 xx xx ...  
71
72            The R line provides the relocation information to the linker.
73         The nn nn value is the current area index, i.e.  which area  the
74         current  values  were  assembled.  Relocation information is en-
75         coded in groups of 4 (possibly 5) bytes:  
76
77              1.  n1 (and optionally n1x) is the relocation mode and object
78                  format:
79                  1.  bit 0 word(0x00)/byte(0x01) 
80                  2.  bit 1 relocatable area(0x00)/symbol(0x02) 
81                  3.  bit 2 normal(0x00)/PC relative(0x04) relocation 
82                  4.  bit 3  1-byte(0x00)/2-byte(0x08) object format for
83                      byte data 
84                  5.  bit 4 signed(0x00)/unsigned(0x10) byte data 
85                  6.  bit 5 normal(0x00)/page '0'(0x20) reference 
86                  7.  bit 6 normal(0x00)/page 'nnn'(0x40) reference 
87                  8.  bit 7  LSB  byte(0x00)/MSB  byte(0x80) with 2-byte
88                      mode
89                  9.  bit 8  1 or 2  (0x00)/3-byte (0x100) object format
90                      for byte data.
91                  10. bit 9  LSB or MSB (middle byte) (0x00) or byte 3 
92                      (real MSB) (0x200) for 3-byte mode.
93
94                 If the upper four bits of n1 are set (i.e. 
95                 (n1 & 0xf0) == 0xf0), it is taken as an escape character, 
96                 and the relocation mode will consist of the lower four bits
97                 of n1 left shifted 8 bits or'ed with the value of n1x. If
98                 the upper four bits of n1 are not all set, then it is not an 
99                 escape character, and the n1x byte is not present.
100
101                 This escape mechanism allows a 12-bit relocation mode value.
102
103                 Note that in byte mode, when 3-byte mode is used (bits 0
104                 and 8 are both set), the MSB bit (bit 7) really refers to 
105                 the 16 bit MSB (the middle byte of the 24-bit value) while
106                 the "byte 3" bit (bit 9) refers to the 24-bit MSB.
107
108              2.  n2  is  a byte index into the corresponding (i.e.  pre-
109                  ceeding) T line data (i.e.  a pointer to the data to be
110                  updated  by  the  relocation).   The T line data may be
111                  1-byte or  2-byte  byte  data  format  or  2-byte  word
112                  format.  
113
114              3.  xx xx  is the area/symbol index for the area/symbol be-
115                  ing referenced.  the corresponding area/symbol is found
116                  in the header area/symbol lists.  
117
118
119         The groups of 4 bytes are repeated for each item requiring relo-
120         cation in the preceeding T line.  
121
122
123         2.5.8  P Line 
124
125                 P 0 0 nn nn n1 n2 xx xx 
126
127            The  P  line provides the paging information to the linker as
128         specified by a .setdp directive.  The format of  the  relocation
129         information is identical to that of the R line.  The correspond-
130         ing T line has the following information:  
131                 T xx xx aa aa bb bb 
132
133            Where  aa aa is the area reference number which specifies the
134         selected page area and bb bb is the base address  of  the  page.
135         bb bb will require relocation processing if the 'n1 n2 xx xx' is
136         specified in the P line.  The linker will verify that  the  base
137         address is on a 256 byte boundary and that the page length of an
138         area defined with the PAG type is not larger than 256 bytes.  
139
140            The  linker  defaults any direct page references to the first
141         area defined in the input REL file.  All ASxxxx assemblers  will
142         specify the _CODE area first, making this the default page area.