1 #define align(x) /* ((x) = ((int) (x) + (4-1)) & ~(4-1)) */
2 #define LOW_BYTE 0 /* must be changed for big-endian */
4 /* const.h - constants for assembler */
8 #undef I80386 /* generate 80386 code */
9 #define MC6809 /* generate 6809 code */
10 #define MNSIZE /* allow byte size in mnemonic, e.g. "movb" */
11 #undef SOS_EDOS /* source OS is EDOS */
15 #define DIRCHAR '/' /* character separating filename from dir */
16 #define INBUFSIZE 8192
17 #define SOS_EOLSTR "\012"
19 /* defaults modified by switches */
23 # define INBUFSIZE 512
25 # define SOS_EOLSTR "\015\012"
26 # define STAKSIZ 256 /* table grows up to stack less this */
41 #define FORWARD static
42 #define PRIVATE static
48 #define CREAT_PERMS 0666
53 /* register codes (internal to assembler) */
57 /* index regs must be first */
63 #define MAX16BITINDREG 3
114 /* index regs must be first, then PC, then other regs */
133 /* type and size keywords */
149 #define MACROCHAR '?'
153 /* the first 2 must be from chars in identifiers */
157 /* the next few are best for other possibly-multi-char tokens */
158 #define ADDOP 2 /* also ++ */
161 #define GREATERTHAN 5 /* also >> and context-sensitive */
163 #define LESSTHAN 7 /* also << and context-sensitive */
164 #define SUBOP 8 /* also -- */
183 #define SLASH 26 /* context-sensitive */
186 #define STAR 29 /* context-sensitive */
187 #define STRINGCONST 30
190 /* these are from assembler errors module */
206 /* expression errors */
224 /* addressing errors */
231 /* control structure errors */
244 /* overflow errors */
265 /* miscellaneous errors */
270 #define NOTIMPLEMENTED 51
280 /* symbol table entry */
282 /* type entry contains following flags */
283 #define ENTBIT (1<<0) /* entry point (=OBJ_N_MASK) */
284 #define COMMBIT (1<<1) /* common */
285 #define LABIT (1<<2) /* label (a PC location or defined by EQU) */
286 #define MNREGBIT (1<<3) /* mnemonic for op or pseudo-op, or register */
287 #define MACBIT (1<<4) /* macro */
288 #define REDBIT (1<<5) /* redefined */
289 #define VARBIT (1<<6) /* variable (i.e. something defined by SET) */
290 #define EXPBIT (1<<7) /* exported (= OBJ_E_MASK) */
292 /* data entry contains following flags, valid */
293 /* for expressions as well as syms */
294 #define PAGE1 (1<<0) /* page 1 machine op = MNREGBIT \ PAGE1 */
295 #define PAGE2 (1<<1) /* page 2 machine op = MNREGBIT \ PAGE2 */
296 #define REGBIT (1<<2) /* register = MNREGBIT \ REGBIT */
297 #define SIZEBIT (1<<3) /* sizing mnemonic = MNREGBIT \ SIZEBIT */
298 #define SEGM 15 /* 1st 4 bits reused for segment if !MNREGBIT */
299 #define RELBIT (1<<4) /* relative (= OBJ_A_MASK) */
300 #define FORBIT (1<<5) /* forward referenced */
301 #define IMPBIT (1<<6) /* imported (= OBJ_I_MASK) */
302 #define UNDBIT (1<<7) /* undefined */
304 /* pseudo-op routine numbers */
305 /* conditionals are first, this is used to test if op is a conditional */
313 #define MAXCOND 6 /* limit of conditionals */
332 #define _MACLISTOP 23
343 /* further pseudo-ops */
352 /* machine-op routine numbers */
377 #define LOAD_FULL_POINTER 60
391 /* further pseudo-ops */
398 /* further machine-ops */
402 /* yet further pseudo-ops */
411 /* machine-op routine numbers */
413 #define ALL 31 /* all address modes allowed, like LDA */
414 #define ALTER 32 /* all but immediate, like STA */
415 #define IMMED 33 /* immediate only (ANDCC, ORCC) */
416 #define INDEXD 34 /* indexed (LEA's) */
417 #define INHER 35 /* inherent, like CLC or CLRA */
418 #define LONG 36 /* long branches */
419 #define SHORT 37 /* short branches */
420 #define SSTAK 38 /* S-stack (PSHS, PULS) */
421 #define SWAP 39 /* TFR, EXG */
422 #define USTAK 40 /* U-stack (PSHU,PULU) */
424 /* yet further pseudo-ops */
430 /* object code format (Introl) */
432 #define OBJ_SEGSZ_TWO 0x02 /* size 2 code for segment size descriptor */
434 #define OBJ_MAX_ABS_LEN 64 /* max length of chunk of absolute code */
436 #define OBJ_ABS 0x40 /* absolute code command */
437 #define OBJ_OFFSET_REL 0x80 /* offset relocation command */
438 #define OBJ_SET_SEG 0x20 /* set segment command */
439 #define OBJ_SKIP_1 0x11 /* skip with 1 byte count */
440 #define OBJ_SKIP_2 0x12 /* skip with 2 byte count */
441 #define OBJ_SKIP_4 0x13 /* skip with 4 byte count */
442 #define OBJ_SYMBOL_REL 0xC0 /* symbol relocation command */
444 #define OBJ_A_MASK 0x10 /* absolute bit(symbols) */
445 #if OBJ_A_MASK - RELBIT /* must match internal format (~byte 1 -> 0) */
446 oops
- RELBIT misplaced
448 #define OBJ_E_MASK 0x80 /* exported bit (symbols) */
449 #if OBJ_E_MASK - EXPBIT /* must match internal format (byte 0 -> 0) */
450 oops
- EXPBIT misplaced
452 #define OBJ_I_MASK 0x40 /* imported bit (symbols) */
453 #if OBJ_I_MASK - IMPBIT /* must match internal format (byte 1 -> 0) */
454 oops
- IMPBIT misplaced
456 #define OBJ_N_MASK 0x01 /* entry bit (symbols) */
457 #if OBJ_N_MASK - ENTBIT /* must match internal format (byte 0 -> 1) */
458 oops
- ENTBIT misplaced
460 #define OBJ_SA_MASK 0x20 /* size allocation bit (symbols) */
461 #define OBJ_SZ_ONE 0x40 /* size one code for symbol value */
462 #define OBJ_SZ_TWO 0x80 /* size two code for symbol value */
463 #define OBJ_SZ_FOUR 0xC0 /* size four code for symbol value */
465 #define OBJ_R_MASK 0x20 /* PC-rel bit (off & sym reloc commands) */
466 #define OBJ_SEGM_MASK 0x0F /* segment mask (symbols, off reloc command) */
468 #define OBJ_OF_MASK 0x03 /* offset size code for symbol reloc */
469 #define OBJ_S_MASK 0x04 /* symbol number size code for symbol reloc */
471 #define SYMLIS_NAMELEN 26
472 #define SYMLIS_LEN (sizeof (struct sym_listing_s))
474 #define FILNAMLEN 64 /* max length of a file name */
475 #define LINLEN 256 /* max length of input line */
476 #define LINUM_LEN 5 /* length of formatted line number */
478 #define SPTSIZ 1024 /* number of symbol ptrs */
479 /* pseudo-op flags */
480 #define POPHI 1 /* set to print hi byte of adr */
481 #define POPLO 2 /* to print lo byte of ADR */
482 #define POPLC 4 /* to print LC */
483 #define POPLONG 8 /* to print high word of ADR */
484 #define MAXBLOCK 8 /* max nesting level of BLOCK stack */
485 #define MAXGET 8 /* max nesting level of GET stack */
486 #define MAXIF 8 /* max nesting level of IF stack */
487 #define MACPSIZ (128/sizeof (struct schain_s))
488 /* size of macro param buffer */
489 #define MAXMAC 8 /* max nesting level of macro stack */
490 #define NLOC 16 /* number of location counters */
492 #define NO_SIB 0340 /* illegal sib (3 with 4) to mean no sib */
495 /* special segments */