annotate doc/object files.txt @ 288:843b1cfb7b5c 2.0

Added autotools files
author lost
date Tue, 27 Jan 2009 05:30:58 +0000
parents 7fbccdd1defb
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
96
7fbccdd1defb Added doc subdirectory to distribution
lost
parents:
diff changeset
1 An object file consists of a series of sections each of which contains a
7fbccdd1defb Added doc subdirectory to distribution
lost
parents:
diff changeset
2 list of exported symbols, a list of incomplete references, and a list of
7fbccdd1defb Added doc subdirectory to distribution
lost
parents:
diff changeset
3 "local" symbols which may be used in calculating incomplete references. Each
7fbccdd1defb Added doc subdirectory to distribution
lost
parents:
diff changeset
4 section will obviously also contain the object code.
7fbccdd1defb Added doc subdirectory to distribution
lost
parents:
diff changeset
5
7fbccdd1defb Added doc subdirectory to distribution
lost
parents:
diff changeset
6 Exported symbols must be completely resolved to an address within the
7fbccdd1defb Added doc subdirectory to distribution
lost
parents:
diff changeset
7 section it is exported from.
7fbccdd1defb Added doc subdirectory to distribution
lost
parents:
diff changeset
8
7fbccdd1defb Added doc subdirectory to distribution
lost
parents:
diff changeset
9 Each object file starts with a magic number and version number. The magic
7fbccdd1defb Added doc subdirectory to distribution
lost
parents:
diff changeset
10 number is the string "LWOBJ16" for this 16 bit object file format. The only
7fbccdd1defb Added doc subdirectory to distribution
lost
parents:
diff changeset
11 defined version number is currently 0. Thus, the first 8 bytes of the object
7fbccdd1defb Added doc subdirectory to distribution
lost
parents:
diff changeset
12 file are:
7fbccdd1defb Added doc subdirectory to distribution
lost
parents:
diff changeset
13
7fbccdd1defb Added doc subdirectory to distribution
lost
parents:
diff changeset
14 4C574F424A313600
7fbccdd1defb Added doc subdirectory to distribution
lost
parents:
diff changeset
15
7fbccdd1defb Added doc subdirectory to distribution
lost
parents:
diff changeset
16 Each section has the following items in order:
7fbccdd1defb Added doc subdirectory to distribution
lost
parents:
diff changeset
17
7fbccdd1defb Added doc subdirectory to distribution
lost
parents:
diff changeset
18 * section name
7fbccdd1defb Added doc subdirectory to distribution
lost
parents:
diff changeset
19 * flags
7fbccdd1defb Added doc subdirectory to distribution
lost
parents:
diff changeset
20 * list of local symbols (and addresses within the section)
7fbccdd1defb Added doc subdirectory to distribution
lost
parents:
diff changeset
21 * list of exported symbols (and addresses within the section)
7fbccdd1defb Added doc subdirectory to distribution
lost
parents:
diff changeset
22 * list of incomplete references along with the expressions to calculate them
7fbccdd1defb Added doc subdirectory to distribution
lost
parents:
diff changeset
23 * the actual object code
7fbccdd1defb Added doc subdirectory to distribution
lost
parents:
diff changeset
24
7fbccdd1defb Added doc subdirectory to distribution
lost
parents:
diff changeset
25 The section starts with the name of the section with a NUL termination
7fbccdd1defb Added doc subdirectory to distribution
lost
parents:
diff changeset
26 followed by a series of flag bytes terminated by NUL. The following flag
7fbccdd1defb Added doc subdirectory to distribution
lost
parents:
diff changeset
27 bytes are defined:
7fbccdd1defb Added doc subdirectory to distribution
lost
parents:
diff changeset
28
7fbccdd1defb Added doc subdirectory to distribution
lost
parents:
diff changeset
29 Byte Meaning
7fbccdd1defb Added doc subdirectory to distribution
lost
parents:
diff changeset
30 00 no more flags
7fbccdd1defb Added doc subdirectory to distribution
lost
parents:
diff changeset
31 01 section is BSS - no actual code is present
7fbccdd1defb Added doc subdirectory to distribution
lost
parents:
diff changeset
32
7fbccdd1defb Added doc subdirectory to distribution
lost
parents:
diff changeset
33 Either a NULL section name or end of file indicate the presence of no more
7fbccdd1defb Added doc subdirectory to distribution
lost
parents:
diff changeset
34 sections.
7fbccdd1defb Added doc subdirectory to distribution
lost
parents:
diff changeset
35
7fbccdd1defb Added doc subdirectory to distribution
lost
parents:
diff changeset
36 Each entry in the exported and local symbols table consists of the symbol
7fbccdd1defb Added doc subdirectory to distribution
lost
parents:
diff changeset
37 (NUL terminated) followed by two bytes which contain the value in big endian
7fbccdd1defb Added doc subdirectory to distribution
lost
parents:
diff changeset
38 order. The end of a symbol table is indicated by a NULL symbol name.
7fbccdd1defb Added doc subdirectory to distribution
lost
parents:
diff changeset
39
7fbccdd1defb Added doc subdirectory to distribution
lost
parents:
diff changeset
40 Each entry in the incomplete references table consists of an expression
7fbccdd1defb Added doc subdirectory to distribution
lost
parents:
diff changeset
41 followed by a 16 bit offset where the reference goes. Expressions are
7fbccdd1defb Added doc subdirectory to distribution
lost
parents:
diff changeset
42 defined as a series of terms up to an "end of expression" term. Each term
7fbccdd1defb Added doc subdirectory to distribution
lost
parents:
diff changeset
43 consists of a single byte which identifies the type of term (see below)
7fbccdd1defb Added doc subdirectory to distribution
lost
parents:
diff changeset
44 followed by any data required by the term. Then end of the list is flagged
7fbccdd1defb Added doc subdirectory to distribution
lost
parents:
diff changeset
45 by a NULL expression (only an end of expression term).
7fbccdd1defb Added doc subdirectory to distribution
lost
parents:
diff changeset
46
7fbccdd1defb Added doc subdirectory to distribution
lost
parents:
diff changeset
47 TERMTYPE Meaning
7fbccdd1defb Added doc subdirectory to distribution
lost
parents:
diff changeset
48 00 end of expression
7fbccdd1defb Added doc subdirectory to distribution
lost
parents:
diff changeset
49 01 integer (16 bit in big endian order follows)
7fbccdd1defb Added doc subdirectory to distribution
lost
parents:
diff changeset
50 02 external symbol reference (NUL term symbol)
7fbccdd1defb Added doc subdirectory to distribution
lost
parents:
diff changeset
51 03 local symbol reference (NUL term symbol)
7fbccdd1defb Added doc subdirectory to distribution
lost
parents:
diff changeset
52 04 operator (1 byte operator number - see below)
7fbccdd1defb Added doc subdirectory to distribution
lost
parents:
diff changeset
53 05 section base address reference
7fbccdd1defb Added doc subdirectory to distribution
lost
parents:
diff changeset
54
7fbccdd1defb Added doc subdirectory to distribution
lost
parents:
diff changeset
55 External references are resolved using other object files while local
7fbccdd1defb Added doc subdirectory to distribution
lost
parents:
diff changeset
56 references are resolved using the local symbol table(s) from this file. This
7fbccdd1defb Added doc subdirectory to distribution
lost
parents:
diff changeset
57 allows local symbols that are not exported to have the same names as
7fbccdd1defb Added doc subdirectory to distribution
lost
parents:
diff changeset
58 exported symbols or external references.
7fbccdd1defb Added doc subdirectory to distribution
lost
parents:
diff changeset
59
7fbccdd1defb Added doc subdirectory to distribution
lost
parents:
diff changeset
60 The operator numbers are:
7fbccdd1defb Added doc subdirectory to distribution
lost
parents:
diff changeset
61
7fbccdd1defb Added doc subdirectory to distribution
lost
parents:
diff changeset
62 NUM OP
7fbccdd1defb Added doc subdirectory to distribution
lost
parents:
diff changeset
63 01 + (plus)
7fbccdd1defb Added doc subdirectory to distribution
lost
parents:
diff changeset
64 02 - (minus)
7fbccdd1defb Added doc subdirectory to distribution
lost
parents:
diff changeset
65 03 * (times)
7fbccdd1defb Added doc subdirectory to distribution
lost
parents:
diff changeset
66 04 / (divide)
7fbccdd1defb Added doc subdirectory to distribution
lost
parents:
diff changeset
67 05 % (modulus)
7fbccdd1defb Added doc subdirectory to distribution
lost
parents:
diff changeset
68 06 \ (integer division)
7fbccdd1defb Added doc subdirectory to distribution
lost
parents:
diff changeset
69 07 bitwise and
7fbccdd1defb Added doc subdirectory to distribution
lost
parents:
diff changeset
70 08 bitwise or
7fbccdd1defb Added doc subdirectory to distribution
lost
parents:
diff changeset
71 09 bitwise xor
7fbccdd1defb Added doc subdirectory to distribution
lost
parents:
diff changeset
72 0A boolean and
7fbccdd1defb Added doc subdirectory to distribution
lost
parents:
diff changeset
73 0B boolean or
7fbccdd1defb Added doc subdirectory to distribution
lost
parents:
diff changeset
74 0C - (unary negation, 2's complement)
7fbccdd1defb Added doc subdirectory to distribution
lost
parents:
diff changeset
75 0D ^ (unary 1's complement)
7fbccdd1defb Added doc subdirectory to distribution
lost
parents:
diff changeset
76
7fbccdd1defb Added doc subdirectory to distribution
lost
parents:
diff changeset
77 An expression is represented in a postfix manner with both operands for
7fbccdd1defb Added doc subdirectory to distribution
lost
parents:
diff changeset
78 binary operators preceding the operator and the single operand for unary
7fbccdd1defb Added doc subdirectory to distribution
lost
parents:
diff changeset
79 operators preceding the operator.