4 * (C) Copyright 1989-1995
12 * - change s_id from [NCPS] to pointer (comment)
14 * - add jflag for debug control
24 * The module asdata.c contains the global constants,
25 * structures, and variables used in the assembler.
28 int aserr; /* ASxxxx error counter
30 jmp_buf jump_env; /* compiler dependent structure
31 * used by setjmp() and longjmp()
33 int inpfil; /* count of assembler
34 * input files specified
36 int incfil; /* current file handle index
39 int cfile; /* current file handle index
40 * of input assembly files
42 int flevel; /* IF-ELSE-ENDIF flag will be non
43 * zero for false conditional case
45 int tlevel; /* current conditional level
47 int ifcnd[MAXIF+1]; /* array of IF statement condition
48 * values (0 = FALSE) indexed by tlevel
50 int iflvl[MAXIF+1]; /* array of IF-ELSE-ENDIF flevel
51 * values indexed by tlevel
54 char afn[PATH_MAX]; /* afile temporary file name
56 char srcfn[MAXFIL][PATH_MAX]; /* array of source file names
58 int srcline[MAXFIL]; /* source line number
60 char incfn[MAXINC][PATH_MAX]; /* array of include file names
62 int incline[MAXINC]; /* include line number
65 int radix; /* current number conversion radix:
66 * 2 (binary), 8 (octal), 10 (decimal),
69 int line; /* current assembler source
72 int page; /* current page number
74 int lop; /* current line number on page
76 int pass; /* assembler pass number
78 int lflag; /* -l, generate listing flag
80 int cflag; /* -lc, generate sdcdb debug info
82 int gflag; /* -g, make undefined symbols global flag
84 int aflag; /* -a, make all symbols global flag
86 int jflag; /* -j, generate debug information flag
88 int oflag; /* -o, generate relocatable output flag
90 int sflag; /* -s, generate symbol table flag
92 int pflag; /* -p, enable listing pagination
94 int xflag; /* -x, listing radix flag
96 int fflag; /* -f(f), relocations flagged flag
98 Addr_T laddr; /* address of current assembler line
99 * or value of .if argument
101 Addr_T fuzz; /* tracks pass to pass changes in the
102 * address of symbols caused by
103 * variable length instruction formats
105 int lmode; /* listing mode
107 char *ep; /* pointer into error list
110 char eb[NERR]; /* array of generated error codes
112 char *ip; /* pointer into the assembler-source
115 char ib[NINPUT]; /* assembler-source text line
117 char *cp; /* pointer to assembler output
120 char cb[NCODE]; /* array of assembler output values
122 int *cpt; /* pointer to assembler relocation type
125 int cbt[NCODE]; /* array of assembler relocation types
126 * describing the data in cb[]
128 char tb[NTITL]; /* Title string buffer
130 char stb[NSBTL]; /* Subtitle string buffer
132 int flat24Mode; /* non-zero if we are using DS390 24 bit
133 * flat mode (via .flat24 directive).
136 char symtbl[] = { "Symbol Table" };
137 char aretbl[] = { "Area Table" };
139 char module[NCPS]; /* module name string
143 * The mne structure is a linked list of the assembler
144 * mnemonics and directives. The list of mnemonics and
145 * directives contained in the device dependent file
146 * xxxpst.c are hashed and linked into NHASH lists in
147 * module assym.c by syminit(). The structure contains
148 * the mnemonic/directive name, a subtype which directs
149 * the evaluation of this mnemonic/directive, a flag which
150 * is used to detect the end of the mnemonic/directive
151 * list in xxxpst.c, and a value which is normally
152 * associated with the assembler mnemonic base instruction
157 * struct mne *m_mp; Hash link
158 * char m_id[NCPS]; Mnemonic
159 * char m_type; Mnemonic subtype
160 * char m_flag; Mnemonic flags
161 * Addr_T m_valu; Value
164 struct mne *mnehash[NHASH];
167 * The sym structure is a linked list of symbols defined
168 * in the assembler source files. The first symbol is "."
169 * defined here. The entry 'struct tsym *s_tsym'
170 * links any temporary symbols following this symbol and
171 * preceeding the next normal symbol. The structure also
172 * contains the symbol's name, type (USER or NEW), flag
173 * (global, assigned, and multiply defined), a pointer
174 * to the area structure defining where the symbol is
175 * located, a reference number assigned by outgsd() in
176 * asout.c, and the symbols address relative to the base
177 * address of the area where the symbol is located.
181 * struct sym *s_sp; Hash link
182 * struct tsym *s_tsym; Temporary symbol link
183 * char *s_id; Symbol (JLH)
184 * char s_type; Symbol subtype
185 * char s_flag; Symbol flags
186 * struct area *s_area; Area line, 0 if absolute
187 * int s_ref; Ref. number
188 * Addr_T s_addr; Address
192 {NULL, NULL, ".", S_USER, S_END, NULL, 0, 0}
195 struct sym *symp; /* pointer to a symbol structure
197 struct sym *symhash[NHASH]; /* array of pointers to NHASH
198 * linked symbol lists
202 * The area structure contains the parameter values for a
203 * specific program or data section. The area structure
204 * is a linked list of areas. The initial default area
205 * is "_CODE" defined here, the next area structure
206 * will be linked to this structure through the structure
207 * element 'struct area *a_ep'. The structure contains the
208 * area name, area reference number ("_CODE" is 0) determined
209 * by the order of .area directives, area size determined
210 * from the total code and/or data in an area, area fuzz is
211 * an variable used to track pass to pass changes in the
212 * area size caused by variable length instruction formats,
213 * and area flags which specify the area's relocation type.
217 * struct area *a_ap; Area link
218 * char a_id[NCPS]; Area Name
219 * int a_ref; Reference number
220 * Addr_T a_size; Area size
221 * Addr_T a_fuzz; Area fuzz
222 * int a_flag; Area flags
225 struct area area[] = {
226 {NULL, "_CODE", 0, 0, 0, A_CON|A_REL}
229 struct area *areap; /* pointer to an area structure
232 FILE *lfp; /* list output file handle
234 FILE *ofp; /* relocation output file handle
236 FILE *tfp; /* symbol table output file handle
238 FILE *sfp[MAXFIL]; /* array of assembler-source file handles
240 FILE *ifp[MAXINC]; /* array of include-file file handles
244 * array of character types, one per
248 /*NUL*/ ILL, ILL, ILL, ILL, ILL, ILL, ILL, ILL,
249 /*BS*/ ILL, SPACE, ILL, ILL, SPACE, ILL, ILL, ILL,
250 /*DLE*/ ILL, ILL, ILL, ILL, ILL, ILL, ILL, ILL,
251 /*CAN*/ ILL, ILL, ILL, ILL, ILL, ILL, ILL, ILL,
252 /*SPC*/ SPACE, ETC, ETC, ETC, LETTER, BINOP, BINOP, ETC,
253 /*(*/ ETC, ETC, BINOP, BINOP, ETC, BINOP, LETTER, BINOP,
254 /*0*/ DGT2, DGT2, DGT8, DGT8, DGT8, DGT8, DGT8, DGT8,
255 /*8*/ DGT10, DGT10, ETC, ETC, BINOP, ETC, BINOP, ETC,
256 /*@*/ ETC, LTR16, LTR16, LTR16, LTR16, LTR16, LTR16, LETTER,
257 /*H*/ LETTER, LETTER, LETTER, LETTER, LETTER, LETTER, LETTER, LETTER,
258 /*P*/ LETTER, LETTER, LETTER, LETTER, LETTER, LETTER, LETTER, LETTER,
259 /*X*/ LETTER, LETTER, LETTER, ETC, ETC, ETC, BINOP, LETTER,
260 /*`*/ ETC, LTR16, LTR16, LTR16, LTR16, LTR16, LTR16, LETTER,
261 /*h*/ LETTER, LETTER, LETTER, LETTER, LETTER, LETTER, LETTER, LETTER,
262 /*p*/ LETTER, LETTER, LETTER, LETTER, LETTER, LETTER, LETTER, LETTER,
263 /*x*/ LETTER, LETTER, LETTER, ETC, BINOP, ETC, ETC, ETC
267 * an array of characters which
268 * perform the case translation function
271 /*NUL*/ '\000', '\001', '\002', '\003', '\004', '\005', '\006', '\007',
272 /*BS*/ '\010', '\011', '\012', '\013', '\014', '\015', '\016', '\017',
273 /*DLE*/ '\020', '\021', '\022', '\023', '\024', '\025', '\026', '\027',
274 /*CAN*/ '\030', '\031', '\032', '\033', '\034', '\035', '\036', '\037',
275 /*SPC*/ '\040', '\041', '\042', '\043', '\044', '\045', '\046', '\047',
276 /*(*/ '\050', '\051', '\052', '\053', '\054', '\055', '\056', '\057',
277 /*0*/ '\060', '\061', '\062', '\063', '\064', '\065', '\066', '\067',
278 /*8*/ '\070', '\071', '\072', '\073', '\074', '\075', '\076', '\077',
279 /*@*/ '\100', '\141', '\142', '\143', '\144', '\145', '\146', '\147',
280 /*H*/ '\150', '\151', '\152', '\153', '\154', '\155', '\156', '\157',
281 /*P*/ '\160', '\161', '\162', '\163', '\164', '\165', '\166', '\167',
282 /*X*/ '\170', '\171', '\172', '\133', '\134', '\135', '\136', '\137',
283 /*`*/ '\140', '\141', '\142', '\143', '\144', '\145', '\146', '\147',
284 /*h*/ '\150', '\151', '\152', '\153', '\154', '\155', '\156', '\157',
285 /*p*/ '\160', '\161', '\162', '\163', '\164', '\165', '\166', '\167',
286 /*x*/ '\170', '\171', '\172', '\173', '\174', '\175', '\176', '\177'