* added compilers lcc and bcc (linux86)
[mascara-docs.git] / compilers / linux86-0.16.17 / as / const.h
blob1b98a8be2e38865623426efb8d528237716ef9d8
2 /* Speed and space hacks for BCC */
3 #ifdef __AS386_16__
4 #define LOW_BYTE 0 /* must be changed for big-endian */
5 #else
7 #define S_ALIGNMENT sizeof(long)
8 #endif
10 /* const.h - constants for assembler */
12 /* major switches */
14 /* #define MC6809 */ /* generate 6809 code */
15 #ifndef MC6809
16 #define I80386 /* generate 80386 code */
17 #endif
18 #define MNSIZE /* allow byte size in mnemonic, e.g. "movb" */
19 #undef SOS_EDOS /* source OS is EDOS */
21 /* defaults */
23 #define DIRCHAR '/' /* character separating filename from dir */
24 #define INBUFSIZE 8192
25 #define SOS_EOLSTR "\012"
27 /* defaults modified by switches */
29 #ifdef SOS_EDOS
30 # undef INBUFSIZE
31 # define INBUFSIZE 512
32 # undef SOS_EOLSTR
33 # define SOS_EOLSTR "\015\012"
34 # define STAKSIZ 256 /* table grows up to stack less this */
35 #endif
37 #ifdef __AS386_16__
38 # undef INBUFSIZE
39 # define INBUFSIZE 512
40 # define STAKSIZ 512 /* table grows up to stack less this */
41 #endif
43 /* booleans */
45 #define FALSE 0
46 #define TRUE 1
48 /* ASCII constants */
50 #define ETB 23
52 /* C tricks */
54 #define EXTERN extern
55 #define FORWARD static
56 #define PRIVATE static
57 #define PUBLIC
58 #define NUL_PTR ((void*)0)
60 /* O/S constants */
62 #define CREAT_PERMS 0666
63 #define EOF (-1)
64 #define STDIN 0
65 #define STDOUT 1
67 enum
69 /* Register codes (internal to assembler). */
70 #ifdef I80386
72 /* Index regs must be first. */
73 BPREG,
74 BXREG,
75 DIREG,
76 SIREG,
77 #define MAX16BITINDREG SIREG
79 EAXREG,
80 EBPREG,
81 EBXREG,
82 ECXREG,
83 EDIREG,
84 EDXREG,
85 ESIREG,
86 ESPREG,
87 #define MAXINDREG ESPREG
89 AXREG,
90 CXREG,
91 DXREG,
92 SPREG,
94 AHREG,
95 ALREG,
96 BHREG,
97 BLREG,
98 CHREG,
99 CLREG,
100 DHREG,
101 DLREG,
103 CSREG,
104 DSREG,
105 ESREG,
106 FSREG,
107 GSREG,
108 SSREG,
110 CR0REG,
111 CR2REG,
112 CR3REG,
113 DR0REG,
114 DR1REG,
115 DR2REG,
116 DR3REG,
117 DR6REG,
118 DR7REG,
119 TR3REG,
120 TR4REG,
121 TR5REG,
122 TR6REG,
123 TR7REG,
125 ST0REG,
126 ST1REG,
127 ST2REG,
128 ST3REG,
129 ST4REG,
130 ST5REG,
131 ST6REG,
132 ST7REG,
133 #endif /* I80386 */
135 #ifdef MC6809
137 /* Index regs must be first, then PC. */
138 SREG,
139 UREG,
140 XREG,
141 YREG,
142 #define MAXINDREG YREG
144 PCREG,
145 AREG,
146 BREG,
147 CCREG,
148 DPREG,
149 DREG,
150 #endif /* MC6809 */
152 NOREG
155 #ifdef I80386
156 enum
158 /* Type and size keywords. */
159 BYTEOP,
160 DWORDOP,
161 FWORDOP,
162 FAROP,
163 PTROP,
164 PWORDOP,
165 QWORDOP,
166 TBYTEOP,
167 WORDOP
169 #endif /* I80386 */
171 /* special chars */
173 #define EOL 0
174 #define MACROCHAR '?'
176 enum
178 /* Symbol codes. */
180 /* The first 2 must be from chars in identifiers. */
181 IDENT,
182 INTCONST,
184 /* The next few are best for other possibly-multi-char tokens. */
185 ADDOP, /* also ++ */
186 BINCONST,
187 CHARCONST,
188 GREATERTHAN, /* also >> and context-sensitive */
189 HEXCONST,
190 LESSTHAN, /* also << and context-sensitive */
191 SUBOP, /* also -- */
192 WHITESPACE,
194 ANDOP,
195 COMMA,
196 EOLSYM,
197 EQOP,
198 IMMEDIATE,
199 INDIRECT,
200 LBRACKET,
201 LPAREN,
202 MACROARG,
203 NOTOP,
204 OROP,
205 OTHERSYM,
206 POSTINCOP,
207 PREDECOP,
208 RBRACKET,
209 RPAREN,
210 SLASH, /* context-sensitive */
211 SLOP,
212 SROP,
213 STAR, /* context-sensitive */
214 STRINGCONST,
215 COLON
218 /* symbol table entry */
220 /* type entry contains following flags */
221 #define ENTBIT (1<<0) /* entry point (= OBJ_N_MASK) */
222 #define COMMBIT (1<<1) /* common */
223 #define LABIT (1<<2) /* label (a PC location or defined by EQU) */
224 #define MNREGBIT (1<<3) /* mnemonic for op or pseudo-op, or register */
225 #define MACBIT (1<<4) /* macro */
226 #define REDBIT (1<<5) /* redefined (if with LABIT or VARBIT), to do
227 * with SA_MASK (if with COMMBIT), otherwise
228 * means globl */
229 #define VARBIT (1<<6) /* variable (i.e. something defined by SET) */
230 #define EXPBIT (1<<7) /* exported (= OBJ_E_MASK) */
232 /* data entry contains following flags, valid */
233 /* for expressions as well as syms */
234 #define PAGE1 (1<<0) /* page 1 machine op = MNREGBIT | PAGE1 */
235 #define PAGE2 (1<<1) /* page 2 machine op = MNREGBIT | PAGE2 */
236 #define REGBIT (1<<2) /* register = MNREGBIT | REGBIT */
237 #define SIZEBIT (1<<3) /* sizing mnemonic = MNREGBIT | SIZEBIT */
238 #define SEGM 0x0F /* 1st 4 bits reused for segment if !MNREGBIT */
239 #define RELBIT (1<<4) /* relative (= OBJ_A_MASK) */
240 #define FORBIT (1<<5) /* forward referenced */
241 #define IMPBIT (1<<6) /* imported (= OBJ_I_MASK) */
242 #define UNDBIT (1<<7) /* undefined */
244 /* object code format (Introl) */
246 #define OBJ_SEGSZ_TWO 0x02 /* size 2 code for segment size descriptor */
248 #define OBJ_MAX_ABS_LEN 64 /* max length of chunk of absolute code */
250 #define OBJ_ABS 0x40 /* absolute code command */
251 #define OBJ_OFFSET_REL 0x80 /* offset relocation command */
252 #define OBJ_SET_SEG 0x20 /* set segment command */
253 #define OBJ_SKIP_1 0x11 /* skip with 1 byte count */
254 #define OBJ_SKIP_2 0x12 /* skip with 2 byte count */
255 #define OBJ_SKIP_4 0x13 /* skip with 4 byte count */
256 #define OBJ_SYMBOL_REL 0xC0 /* symbol relocation command */
258 #define OBJ_A_MASK 0x10 /* absolute bit(symbols) */
259 #if OBJ_A_MASK - RELBIT /* must match internal format (~byte 1 -> 0) */
260 oops - RELBIT misplaced
261 #endif
262 #define OBJ_E_MASK 0x80 /* exported bit (symbols) */
263 #if OBJ_E_MASK - EXPBIT /* must match internal format (byte 0 -> 0) */
264 oops - EXPBIT misplaced
265 #endif
266 #define OBJ_I_MASK 0x40 /* imported bit (symbols) */
267 #if OBJ_I_MASK - IMPBIT /* must match internal format (byte 1 -> 0) */
268 oops - IMPBIT misplaced
269 #endif
270 #define OBJ_N_MASK 0x01 /* entry bit (symbols) */
271 #if OBJ_N_MASK - ENTBIT /* must match internal format (byte 0 -> 1) */
272 oops - ENTBIT misplaced
273 #endif
274 #define OBJ_SA_MASK 0x20 /* size allocation bit (symbols) */
275 #define OBJ_SZ_ONE 0x40 /* size one code for symbol value */
276 #define OBJ_SZ_TWO 0x80 /* size two code for symbol value */
277 #define OBJ_SZ_FOUR 0xC0 /* size four code for symbol value */
279 #define OBJ_R_MASK 0x20 /* PC-rel bit (off & sym reloc commands) */
280 #define OBJ_SEGM_MASK 0x0F /* segment mask (symbols, off reloc command) */
282 #define OBJ_OF_MASK 0x03 /* offset size code for symbol reloc */
283 #define OBJ_S_MASK 0x04 /* symbol number size code for symbol reloc */
285 #define SYMLIS_NAMELEN 26
286 #define SYMLIS_LEN (sizeof (struct sym_listing_s))
288 #define FILNAMLEN 64 /* max length of a file name */
289 #define LINLEN 256 /* max length of input line */
290 #define LINUM_LEN 5 /* length of formatted line number */
292 #define SPTSIZ 1024 /* number of symbol ptrs */
293 /* pseudo-op flags */
294 #define POPHI 1 /* set to print hi byte of adr */
295 #define POPLO 2 /* to print lo byte of ADR */
296 #define POPLC 4 /* to print LC */
297 #define POPLONG 8 /* to print high word of ADR */
298 #define MAXBLOCK 8 /* max nesting level of BLOCK stack */
299 #define MAXGET 8 /* max nesting level of GET stack */
300 #define MAXIF 8 /* max nesting level of IF stack */
301 #define MACPSIZ (128 / sizeof (struct schain_s))
302 /* size of macro param buffer */
303 #define MAXMAC 8 /* max nesting level of macro stack */
304 #define NLOC 16 /* number of location counters */
305 #ifdef I80386
306 #define NO_SIB 0340 /* illegal sib (3 with 4) to mean no sib */
307 #endif
309 /* special segments */
311 #define BSSLOC 3
312 #define DATALOC 3
313 #define DPLOC 2
314 #define STRLOC 1
315 #define TEXTLOC 0
317 #include "errors.h"