-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathobj816.h
181 lines (155 loc) · 5.2 KB
/
obj816.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
#ifndef __obj816_h__
#define __obj816_h__
#include <stdint.h>
#pragma pack(push, 1)
#define VERS " 3.01 " /* version number for programs */
#define CDATE "1992-1997" /* copyright date for programs */
typedef struct Mod_head {
uint32_t h_magic; /* magic number for detection */
uint16_t h_version; /* version number of object format */
uint8_t h_filtyp; /* file type, object or library */
uint8_t h_namlen; /* length of module name */
uint32_t h_recsize; /* sizeof records section */
uint16_t h_secsize; /* sizeof section section */
uint32_t h_symsize; /* sizeof symbol section */
uint16_t h_optsize; /* sizeof options section */
uint8_t h_tot_secs; /* total number of sections in module */
uint8_t h_num_secs; /* number of sections referenced */
uint16_t h_num_syms; /* number of symbols */
} Mod_head;
typedef struct Lib_head {
uint32_t l_magic; /* magic number for detection */
uint16_t l_version; /* version number of object format */
uint8_t l_filtyp; /* file type, object or library */
uint8_t l_unused1;
uint32_t l_modstart; /* offset of modules start */
uint32_t l_numsyms; /* number of symbol entries */
uint32_t l_symsize; /* sizeof symbol section */
uint32_t l_numfiles; /* number of files */
} Lib_head;
#define MOD_CONVERT "lwbblslsbbw"
#define LIB_CONVERT "lwbbllll"
#define MOD_REC_OFF(x) (sizeof(x)+x.h_namlen)
#define MOD_SEC_OFF(x) (MOD_REC_OFF(x)+x.h_recsize)
#define MOD_SYM_OFF(x) (MOD_SEC_OFF(x)+x.h_secsize)
#define MOD_OPT_OFF(x) (MOD_SYM_OFF(x)+x.h_symsize)
#define MOD_NEXT_OFF(x) (MOD_OPT_OFF(x)+x.h_optsize)
#define MOD_MAGIC 0x5a44525a /* 'ZRDZ' */
#define MOD_VERSION 1
#define MOD_OBJECT 1
#define MOD_LIBRARY 2
#define MOD_OBJ68K 3
#define REC_END 0
/* 1-xx are numbers of constant data bytes */
#define REC_SECT 0xf0 /* next word is section number */
#define REC_EXPR 0xf1 /* expression follows */
#define REC_SPACE 0xf2 /* word count of bytes to reserve */
#define REC_ORG 0xf3 /* long word new pc */
#define REC_RELEXP 0xf4 /* pc-relative expression */
#define REC_DEBUG 0xf5 /* debug info record */
#define REC_LINE 0xf6 /* bump line counter */
enum {
OP_END=0, /* end of expression */
OP_SYM, /* ref to extern symbol */
OP_VAL, /* constant value */
OP_LOC, /* ref to offset from start of section */
OP_UNA=10,
OP_NOT=10,
OP_NEG,
OP_FLP,
OP_BIN=20,
OP_EXP=20, OP_MUL, OP_DIV, OP_MOD, OP_SHR,
OP_SHL, OP_ADD, OP_SUB, OP_AND, OP_OR,
OP_XOR, OP_EQ, OP_GT, OP_LT, OP_UGT,
OP_ULT,
OP_LAST
};
enum { S_UND, S_ABS, S_REL, S_EXP, S_REG, S_FREG }; /* symbol type */
enum { ST_NOSIZE, ST_8BIT, ST_16BIT, ST_32BIT,
ST_FLOAT, ST_DOUBLE, ST_8051, ST_Z8, ST_DS, ST_EQU };
enum {
D_C_FILE=100,
D_C_LINE,
D_C_SYM,
D_C_STAG,
D_C_ETAG,
D_C_UTAG,
D_C_MEMBER,
D_C_EOS,
D_C_FUNC,
D_C_ENDFUNC,
D_C_BLOCK,
D_C_ENDBLOCK,
D_LONGA_ON,
D_LONGA_OFF,
D_LONGI_ON,
D_LONGI_OFF
};
/* used for generating source level debugging information */
enum { DT_NON, DT_PTR, DT_FCN, DT_ARY, DT_FPTR, DT_FFCN };
enum { T_NULL, T_VOID, T_SCHAR, T_CHAR, T_SHORT, T_INT16, T_INT32, T_LONG,
T_FLOAT, T_DOUBLE, T_STRUCT, T_UNION, T_ENUM, T_LDOUBLE,
T_UCHAR, T_USHORT, T_UINT16, T_UINT32, T_ULONG };
enum { C_NULL, C_AUTO, C_EXT, C_STAT, C_REG, C_EXTDEF, C_ARG,
C_STRTAG, C_MOS, C_EOS, C_UNTAG, C_MOU, C_ENTAG, C_MOE,
C_TPDEF, C_USTATIC, C_REGPARM, C_FIELD, C_UEXT, C_STATLAB,
C_EXTLAB, C_BLOCK, C_EBLOCK, C_FUNC, C_EFUNC, C_FILE, C_LINE,
C_FRAME };
#define SF_GBL 0x01 /* label is global */
#define SF_DEF 0x02 /* label is defined in this module */
#define SF_REF 0x04 /* label is referenced in this module */
#define SF_VAR 0x08 /* label is variable */
#define SF_PG0 0x10 /* label is Page0 type */
#define SF_TMP 0x20 /* label is temporary (LLCHAR) */
#define SF_DEF2 0x40 /* label has been defined in pass 2 ( ZAS only ) */
#define SF_LIB 0x40 /* label in library (used by ZLN) */
#define SEC_OFFSET 0x0001
#define SEC_INDIRECT 0x0002
#define SEC_STACKED 0x0004
#define SEC_REF_ONLY 0x0008
#define SEC_CONST 0x0010
#define SEC_DIRECT 0x0020
#define SEC_NONAME 0x0040
#define SEC_DATA 0x0080
/* pre-defined sections */
enum {SECT_PAGE0, SECT_CODE, SECT_KDATA, SECT_DATA, SECT_UDATA };
/*
Module format:
Module header
s: Module name (null terminated)
Records
Each record is in stack order terminated by REC_END
Section info
Section info format: --- for each section that has references
b: section number
b: section flags
l: size
l: org
s: name of section (only if SEC_NONAME not in flags)
Symbol info
Symbol info format: --- for each symbol
b: type
b: flags
b: section number
l: offset (only if type != S_UND)
s: name of symbol (null terminated)
Library format:
Library header
File info - for each file
w: file number
b: file name len
c: file name (no null)
Symbol data - for each symbol
w: offset of name
w: file number
l: module offset - Hdr.l_modstart
Symbol names - for each symbol
b: length of name
c: symbol name (no null)
Modules - each module
*/
/**************************************************/
/* End of File OBJ816.H */
/**************************************************/
#pragma pack(pop)
#endif