2 /* Speed and space hacks for BCC */
4 #define LOW_BYTE 0 /* must be changed for big-endian */
7 #define S_ALIGNMENT sizeof(long)
10 /* const.h - constants for assembler */
14 /* #define MC6809 */ /* generate 6809 code */
16 #define I80386 /* generate 80386 code */
18 #define MNSIZE /* allow byte size in mnemonic, e.g. "movb" */
19 #undef SOS_EDOS /* source OS is EDOS */
23 #define DIRCHAR '/' /* character separating filename from dir */
24 #define INBUFSIZE 8192
25 #define SOS_EOLSTR "\012"
27 /* defaults modified by switches */
31 # define INBUFSIZE 512
33 # define SOS_EOLSTR "\015\012"
34 # define STAKSIZ 256 /* table grows up to stack less this */
39 # define INBUFSIZE 512
40 # define STAKSIZ 512 /* table grows up to stack less this */
55 #define FORWARD static
56 #define PRIVATE static
58 #define NUL_PTR ((void*)0)
62 #define CREAT_PERMS 0666
69 /* Register codes (internal to assembler). */
72 /* Index regs must be first. */
77 #define MAX16BITINDREG SIREG
87 #define MAXINDREG ESPREG
137 /* Index regs must be first, then PC. */
142 #define MAXINDREG YREG
158 /* Type and size keywords. */
174 #define MACROCHAR '?'
180 /* The first 2 must be from chars in identifiers. */
184 /* The next few are best for other possibly-multi-char tokens. */
188 GREATERTHAN
, /* also >> and context-sensitive */
190 LESSTHAN
, /* also << and context-sensitive */
210 SLASH
, /* context-sensitive */
213 STAR
, /* context-sensitive */
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
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
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
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
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
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 */
306 #define NO_SIB 0340 /* illegal sib (3 with 4) to mean no sib */
309 /* special segments */