8 /* max # of bytes in db directive */
11 /* max # char in symbol name */
12 #define MAX_SYMBOL 1024
14 /* max # of bytes per line */
17 /* REL() computes branch operand from dest and memory */
18 /* location of the jump instruction itself */
19 /* this is later adjusted by one for jcu, of course */
20 #define BRANCH_SPACING 2
21 #define REL(dest, mem) (((dest)-((((mem)+1)/(\
22 BRANCH_SPACING))*(BRANCH_SPACING)))/(BRANCH_SPACING))
24 #define NOP_OPCODE 0 /* opcode for NOP */
26 /* a linked list of all the symbols */
31 int istarget; /* 1 if a branch target, 0 otherwise */
32 int isdef; /* 1 if defined, 0 if no value yet */
33 int line_def; /* line in which is was defined */
34 int isbit; /* 1 if a bit address, 0 otherwise */
36 int isreg; /* 1 if a register, 0 otehrwise */
37 int global ; /* is defined as global */
38 char mode; /* Absolute, Relative, Tmplabel, eXternal */
39 short lk_index; /* symbol index for the linker */
40 int area; /* the area that this symbol is in */
41 struct symbol *next; };
43 /* a list of all the symbols that are branch targets */
44 /* (and will need to get aligned on 4 byte boundries) */
48 struct target *next; };
57 extern int current_area;
59 #define MEM_POS (area[current_area].alloc_position)
77 extern struct area_struct area[NUM_AREAS];
82 extern int p1, p2, p3, mem, m_len;
84 extern struct symbol * build_sym_list(char *thename);
85 extern int assign_value(char *thename, int thevalue, char mode);
86 extern int mk_bit(char *thename, int current_area);
87 extern int mk_reg(char *thename);
88 extern void out(int *byte_list, int num);
89 extern int is_target(char *thename);
90 extern void pad_with_nop();
91 extern int binary2int(char *str);
92 extern int is_bit(char *thename);
93 extern int is_reg(char *thename);
94 extern struct symbol * is_def(char *thename);
95 extern struct symbol * is_ref(char *thename);
96 extern int get_value(char *thename);
97 extern struct symbol *findSymbol (char *thename);
98 extern char rel_line[2][132];
99 extern char operand[2][MAX_SYMBOL];
100 extern void error(char*);
101 int mk_bit(char*, int);
103 int mk_global(char*);
104 struct target * build_target_list(char *thename);
105 struct symbol * build_sym_list(char *);
106 int find_size_reg(int op1spec);
107 int find_size0(int isize);
108 int find_size1(int isize, int op1spec);
109 int find_size2(int isize, int op1spec, int op2spec);
110 int yyerror(char *s);
111 int imm_data4_signed(int value);
112 int imm_data4_unsigned(int value);
113 int imm_data5_unsigned(int value);
114 int imm_data8(int value);
115 int imm_data16(int value);
116 int reg(int reg_spec);
117 int reg_indirect(int reg_spec);
120 int direct_addr(int value);
121 int bit_addr(int value);
122 int rel16(int pos, int dest);
123 int rel8(int pos, int dest);
124 char *areaToString (int area);
126 FILE *frel, *fmem, *list_fp, *sym_fp;
128 extern void relout();