4 * (C) Copyright 1989-1995
20 * The module asdata.c contains the global constants,
21 * structures, and variables used in the assembler.
24 int aserr; /* ASxxxx error counter
26 jmp_buf jump_env; /* compiler dependent structure
27 * used by setjmp() and longjmp()
29 int inpfil; /* count of assembler
30 * input files specified
32 int incfil; /* current file handle index
35 int cfile; /* current file handle index
36 * of input assembly files
38 int flevel; /* IF-ELSE-ENDIF flag will be non
39 * zero for false conditional case
41 int tlevel; /* current conditional level
43 int ifcnd[MAXIF+1]; /* array of IF statement condition
44 * values (0 = FALSE) indexed by tlevel
46 int iflvl[MAXIF+1]; /* array of IF-ELSE-ENDIF flevel
47 * values indexed by tlevel
50 char afn[FILSPC]; /* afile temporary file name
52 char srcfn[MAXFIL][FILSPC]; /* array of source file names
54 int srcline[MAXFIL]; /* source line number
56 char incfn[MAXINC][FILSPC]; /* array of include file names
58 int incline[MAXINC]; /* include line number
61 int radix; /* current number conversion radix:
62 * 2 (binary), 8 (octal), 10 (decimal),
65 int line; /* current assembler source
68 int page; /* current page number
70 int lop; /* current line number on page
72 int pass; /* assembler pass number
74 int lflag; /* -l, generate listing flag
76 int gflag; /* -g, make undefined symbols global flag
78 int aflag; /* -a, make all symbols global flag
80 int oflag; /* -o, generate relocatable output flag
82 int sflag; /* -s, generate symbol table flag
84 int pflag; /* -p, enable listing pagination
86 int xflag; /* -x, listing radix flag
88 int fflag; /* -f(f), relocations flagged flag
90 addr_t laddr; /* address of current assembler line
91 * or value of .if argument
93 addr_t fuzz; /* tracks pass to pass changes in the
94 * address of symbols caused by
95 * variable length instruction formats
97 int lmode; /* listing mode
99 char *ep; /* pointer into error list
102 char eb[NERR]; /* array of generated error codes
104 char *ip; /* pointer into the assembler-source
107 char ib[NINPUT]; /* assembler-source text line
109 char *cp; /* pointer to assembler output
112 char cb[NCODE]; /* array of assembler output values
114 int *cpt; /* pointer to assembler relocation type
117 int cbt[NCODE]; /* array of assembler relocation types
118 * describing the data in cb[]
120 char tb[NTITL]; /* Title string buffer
122 char stb[NSBTL]; /* Subtitle string buffer
125 char symtbl[] = { "Symbol Table" };
126 char aretbl[] = { "Area Table" };
128 char module[NCPS]; /* module name string
132 * The mne structure is a linked list of the assembler
133 * mnemonics and directives. The list of mnemonics and
134 * directives contained in the device dependent file
135 * xxxpst.c are hashed and linked into NHASH lists in
136 * module assym.c by syminit(). The structure contains
137 * the mnemonic/directive name, a subtype which directs
138 * the evaluation of this mnemonic/directive, a flag which
139 * is used to detect the end of the mnemonic/directive
140 * list in xxxpst.c, and a value which is normally
141 * associated with the assembler mnemonic base instruction
146 * struct mne *m_mp; Hash link
147 * char m_id[NCPS]; Mnemonic
148 * char m_type; Mnemonic subtype
149 * char m_flag; Mnemonic flags
150 * addr_t m_valu; Value
153 struct mne *mnehash[NHASH];
156 * The sym structure is a linked list of symbols defined
157 * in the assembler source files. The first symbol is "."
158 * defined here. The entry 'struct tsym *s_tsym'
159 * links any temporary symbols following this symbol and
160 * preceeding the next normal symbol. The structure also
161 * contains the symbol's name, type (USER or NEW), flag
162 * (global, assigned, and multiply defined), a pointer
163 * to the area structure defining where the symbol is
164 * located, a reference number assigned by outgsd() in
165 * asout.c, and the symbols address relative to the base
166 * address of the area where the symbol is located.
170 * struct sym *s_sp; Hash link
171 * struct tsym *s_tsym; Temporary symbol link
172 * char s_id[NCPS]; Symbol
173 * char s_type; Symbol subtype
174 * char s_flag; Symbol flags
175 * struct area *s_area; Area line, 0 if absolute
176 * int s_ref; Ref. number
177 * addr_t s_addr; Address
181 NULL, NULL, ".", S_USER, S_END, NULL, 0, 0
184 struct sym *symp; /* pointer to a symbol structure
186 struct sym *symhash[NHASH]; /* array of pointers to NHASH
187 * linked symbol lists
191 * The area structure contains the parameter values for a
192 * specific program or data section. The area structure
193 * is a linked list of areas. The initial default area
194 * is "_CODE" defined here, the next area structure
195 * will be linked to this structure through the structure
196 * element 'struct area *a_ep'. The structure contains the
197 * area name, area reference number ("_CODE" is 0) determined
198 * by the order of .area directives, area size determined
199 * from the total code and/or data in an area, area fuzz is
200 * an variable used to track pass to pass changes in the
201 * area size caused by variable length instruction formats,
202 * and area flags which specify the area's relocation type.
206 * struct area *a_ap; Area link
207 * char a_id[NCPS]; Area Name
208 * int a_ref; Reference number
209 * addr_t a_size; Area size
210 * addr_t a_fuzz; Area fuzz
211 * int a_flag; Area flags
214 struct area area[] = {
215 NULL, "_CODE", 0, 0, 0, A_CON|A_REL
218 struct area *areap; /* pointer to an area structure
221 FILE *lfp; /* list output file handle
223 FILE *ofp; /* relocation output file handle
225 FILE *tfp; /* symbol table output file handle
227 FILE *sfp[MAXFIL]; /* array of assembler-source file handles
229 FILE *ifp[MAXINC]; /* array of include-file file handles
233 * array of character types, one per
237 /*NUL*/ ILL, ILL, ILL, ILL, ILL, ILL, ILL, ILL,
238 /*BS*/ ILL, SPACE, ILL, ILL, SPACE, ILL, ILL, ILL,
239 /*DLE*/ ILL, ILL, ILL, ILL, ILL, ILL, ILL, ILL,
240 /*CAN*/ ILL, ILL, ILL, ILL, ILL, ILL, ILL, ILL,
241 /*SPC*/ SPACE, ETC, ETC, ETC, LETTER, BINOP, BINOP, ETC,
242 /*(*/ ETC, ETC, BINOP, BINOP, ETC, BINOP, LETTER, BINOP,
243 /*0*/ DGT2, DGT2, DGT8, DGT8, DGT8, DGT8, DGT8, DGT8,
244 /*8*/ DGT10, DGT10, ETC, ETC, BINOP, ETC, BINOP, ETC,
245 /*@*/ ETC, LTR16, LTR16, LTR16, LTR16, LTR16, LTR16, LETTER,
246 /*H*/ LETTER, LETTER, LETTER, LETTER, LETTER, LETTER, LETTER, LETTER,
247 /*P*/ LETTER, LETTER, LETTER, LETTER, LETTER, LETTER, LETTER, LETTER,
248 /*X*/ LETTER, LETTER, LETTER, ETC, ETC, ETC, BINOP, LETTER,
249 /*`*/ ETC, LTR16, LTR16, LTR16, LTR16, LTR16, LTR16, LETTER,
250 /*h*/ LETTER, LETTER, LETTER, LETTER, LETTER, LETTER, LETTER, LETTER,
251 /*p*/ LETTER, LETTER, LETTER, LETTER, LETTER, LETTER, LETTER, LETTER,
252 /*x*/ LETTER, LETTER, LETTER, ETC, BINOP, ETC, ETC, ETC
256 * an array of characters which
257 * perform the case translation function
262 /*NUL*/ '\000', '\001', '\002', '\003', '\004', '\005', '\006', '\007',
263 /*BS*/ '\010', '\011', '\012', '\013', '\014', '\015', '\016', '\017',
264 /*DLE*/ '\020', '\021', '\022', '\023', '\024', '\025', '\026', '\027',
265 /*CAN*/ '\030', '\031', '\032', '\033', '\034', '\035', '\036', '\037',
266 /*SPC*/ '\040', '\041', '\042', '\043', '\044', '\045', '\046', '\047',
267 /*(*/ '\050', '\051', '\052', '\053', '\054', '\055', '\056', '\057',
268 /*0*/ '\060', '\061', '\062', '\063', '\064', '\065', '\066', '\067',
269 /*8*/ '\070', '\071', '\072', '\073', '\074', '\075', '\076', '\077',
270 /*@*/ '\100', '\141', '\142', '\143', '\144', '\145', '\146', '\147',
271 /*H*/ '\150', '\151', '\152', '\153', '\154', '\155', '\156', '\157',
272 /*P*/ '\160', '\161', '\162', '\163', '\164', '\165', '\166', '\167',
273 /*X*/ '\170', '\171', '\172', '\133', '\134', '\135', '\136', '\137',
274 /*`*/ '\140', '\141', '\142', '\143', '\144', '\145', '\146', '\147',
275 /*h*/ '\150', '\151', '\152', '\153', '\154', '\155', '\156', '\157',
276 /*p*/ '\160', '\161', '\162', '\163', '\164', '\165', '\166', '\167',
277 /*x*/ '\170', '\171', '\172', '\173', '\174', '\175', '\176', '\177'