1 /* ----------------------------------------------------------------------
3 * PACKAGE: as31 - 8031/8051 Assembler.
6 * The sole header file for the 8031/8051 assembler package.
7 * It defines several structures used by the yacc stack.
8 * It defines several macros for testing the bitsize of numeric
11 * Some macros to extract information from the mode structure.
14 * Jan. 19, 1990 - Created. (Ken Stauffer)
17 * All code in this file written by Ken Stauffer (University of Calgary).
26 #define INC_CMD ".inc"
28 /* ----------------------------------------------------------------------
29 * user / keyword symbol structures:
49 /* these are unused... maybe someday the can be used and the */
50 /* parser can check that each addressing mode is using the */
51 /* correct type of data, or a generic LABEL type */
58 /* ----------------------------------------------------------------------
59 * addressing mode stuff:
63 unsigned char mode; /* value to index with */
64 unsigned char size; /* # of bytes used */
65 unsigned char orval; /* value OR'd to obcode */
66 unsigned char byte1; /* extra byte 1 */
67 unsigned char byte2; /* extra byte 2 */
70 #define set_md(m,a) ((m).mode=(a))
71 #define set_sz(m,a) ((m).size=(a))
72 #define set_ov(m,a) ((m).orval=(a))
73 #define set_b1(m,a) ((m).byte1=(a))
74 #define set_b2(m,a) ((m).byte2=(a))
76 #define get_md(m) ((m).mode)
77 #define get_sz(m) ((m).size)
78 #define get_ov(m) ((m).orval)
79 #define get_b1(m) ((m).byte1)
80 #define get_b2(m) ((m).byte2)
82 /* ----------------------------------------------------------------------
88 unsigned char d; /* expression defined flag */
100 #define YYSTYPE union ystack
102 /* ----------------------------------------------------------------------
104 * True is the byte 'a' is the byte address of a bit mapped
107 #define isbmram(a) (((a)&0xf0)==0x20)
109 /* ----------------------------------------------------------------------
111 * True is the byte 'a' is the byte address of a bit mapped
112 * SPECIAL FUCTION REGISTER.
114 #define isbmsfr(a) (((a)&0x80) && !((a) & 0x07))
116 /* ----------------------------------------------------------------------
118 * Macros to check the sizes of values and to convert
119 * a value to a certain, size.
122 #define size8 (~0x00ff)
123 #define size11 (~0x07ff)
124 #define size13 (~0x1fff)
125 #define size16 (~0xffff)
127 #define size10 (~0x03ff)
128 #define size12 (~0x0fff)
129 #define size15 (~0x7fff)
131 #define isbit8(v) ( !( ((v)>=0) ? (v)&size8 : -(v)>=128) )
132 #define isbit11(v) ( !( ((v)>=0) ? (v)&size11 : (-(v))&size10 ) )
133 #define isbit13(v) ( !( ((v)>=0) ? (v)&size13 : (-(v))&size12 ) )
134 #define isbit16(v) ( !( ((v)>=0) ? (v)&size16 : (-(v))&size15 ) )
136 /* ----------------------------------------------------------------------
137 * Size of user hash table. Use a prime number for best performance
139 #define HASHTABSIZE 4999
141 /* ----------------------------------------------------------------------
142 * Macros to nicely test which pass we are in.
144 #define pass1 (!pass)
150 extern int yylex(void);
151 extern int seek_eol(void);
152 extern const char *get_last_token(void);
157 extern int yyparse(void);
158 extern void clear_location_counter(void);
162 extern void emitusage(void);
163 extern const char *emit_extension(const char *ftype);
164 extern const char *emit_desc_lookup(int num);
165 extern const char *emit_desc_to_name_lookup(const char *desc);
166 extern int emitopen(const char *file, const char *ftype, const char *arg);
167 extern void emitclose(void);
168 extern void emitaddr(unsigned long a);
169 extern void emitbyte(int b);
173 extern struct opcode *lookop(const char *s);
174 extern struct symbol *looksym(const char *s);
175 extern void syminit(void);
176 extern void freesym(void);
180 extern int run_as31(const char *infile, int lst, int use_stdout,
181 const char *fmt, const char *arg, const char *customoutfile);
182 extern void error(const char *fmt, ...);
183 extern void warn(const char *fmt, ...);
184 extern void mesg_f(const char *fmt, ...);
187 extern int abort_asap;
188 extern unsigned long lc;
189 extern FILE *listing;
192 /* from as31.c or as31_gtk.c */
193 extern void mesg(const char *str);
194 extern void showhelp(const char *cmd);