1 /* globvar.h - global variables for assembler */
2 
3 /* global control and bookkeeping */
4 
5 EXTERN bool_t binaryc;		/* current binary code flag */
6 EXTERN bool_t binaryg;		/* global binary code flag */
7 EXTERN offset_t binmbuf;	/* offset in binary code buffer for memory */
8 EXTERN bool_t binmbuf_set;	/* set to 1 when binmbuf set by org */
9 
10 EXTERN unsigned char dirpag;	/* direct page */
11 
12 EXTERN bool_t globals_only_in_obj;	/* global symbols only in object file */
13 
14 EXTERN bool_t jumps_long;	/* make all jumps long */
15 
16 EXTERN unsigned char mapnum;	/* global map number */
17 
18 EXTERN bool_t objectc;		/* current object code flag */
19 EXTERN bool_t objectg;		/* global object code flag */
20 
21 EXTERN bool_t pass;		/* pass, FALSE means 0, TRUE means 1 */
22 
23 EXTERN offset_t progent;	/* program entry point */
24 
25 EXTERN bool_t symgen;		/* generate symbol table flag */
26 
27 EXTERN unsigned toterr;		/* total errors */
28 EXTERN unsigned totwarn;	/* total warnings */
29 
30 EXTERN bool_t list_force;	/* Force line to be listed - no error */
31 
32 /* bookeeping for current line */
33 
34 EXTERN char *linebuf;		/* buffer */
35 
36 /* for symbol table routines */
37 
38 EXTERN unsigned char inidata;	/* init sym entry data governed by "u" flag */
39 EXTERN struct sym_s **spt;	/* symbol pointer table */
40 EXTERN struct sym_s **spt_top;	/* top of symbol ptr table */
41 
42 /* for translator */
43 
44 EXTERN struct sym_s *label;	/* non-null if valid label starts line */
45 EXTERN unsigned char pedata;	/* shows how PROGENT bound, flags like LCDATA*/
46 EXTERN unsigned char popflags;	/* pseudo-op flags */
47 
48 /* for BLOCK stack */
49 
50 EXTERN struct block_s *blockstak;	/* stack ptr */
51 EXTERN unsigned char blocklevel;	/* nesting level */
52 
53 /* for IF stack */
54 
55 EXTERN struct if_s *ifstak;	/* stack ptr */
56 EXTERN unsigned char iflevel;	/* nesting level */
57 EXTERN bool_t ifflag;		/* set if assembling */
58 
59 /* location counters for various segments */
60 
61 EXTERN offset_t lc;		/* location counter */
62 EXTERN unsigned char lcdata;	/* shows how lc is bound */
63 				/* FORBIT is set if lc is forward referenced */
64 				/* RELBIT is is if lc is relocat. (not ASEG) */
65 EXTERN offset_t lcjump; 	/* lc jump between lines */
66 
67 EXTERN offset_t oldlabel; 	/* Used for checking for moving labels */
68 #ifdef LOW_BYTE
69 #define mcount (((unsigned char *) &lcjump)[LOW_BYTE])
70 				/* low byte of lcjump */
71 #else
72 #define mcount lcjump		/* I think this is just a speed hack */
73 #endif
74 EXTERN struct lc_s *lcptr;	/* top of current spot in lctab */
75 EXTERN struct lc_s *lctab;	/* start of lctab */
76 EXTERN struct lc_s *lctabtop;	/* top of lctab */
77 
78 /* for code generator */
79 
80 EXTERN opsize_t mnsize;		/* 1 if forced byte operand size, else 0 */
81 EXTERN opcode_t page;
82 EXTERN opcode_t opcode;
83 EXTERN opcode_t postb;		/* postbyte, 0 if none */
84 EXTERN unsigned char pcrflag;	/* OBJ_RMASK set if addressing is PC-relative */
85 EXTERN int last_pass;		/* Pass number of last pass */
86 EXTERN int dirty_pass;		/* Set if this pass had a label movement */
87 
88 EXTERN int textseg;		/* Text segment id */
89 
90 #ifdef I80386
91 
92 EXTERN opcode_t aprefix;	/* address size prefix or 0 */
93 EXTERN bool_t asld_compatible;	/* asld compatibility flag */
94 EXTERN opsize_t defsize;	/* current default size */
95 EXTERN opsize_t idefsize;	/* initial default size */
96 EXTERN opcode_t oprefix;	/* operand size prefix or 0 */
97 EXTERN opcode_t sprefix;	/* segment prefix or 0 */
98 EXTERN opcode_t sib;		/* scale-index-base byte */
99 
100 EXTERN int cpuid;		/* Assembler instruction limit flag */
101 EXTERN int origcpuid;		/* Assembler instruction limit flag */
102 
103 #endif
104 
105 /* miscellaneous */
106 
107 extern char hexdigit[];
108 
109 /* cpuid functions */
110 #ifdef I80386
111 #ifndef __AS386_16__
112 #define iscpu(x) (cpuid>=(x))
113 #define needcpu(x) do{ if(cpuid<(x)) {warning(CPUCLASH); cpuid|=0x10;} }while(0)
114 #define setcpu(x) (cpuid=(x))
115 #define cpuwarn() (cpuid&=0xF)
116 #endif
117 #endif
118 
119 #ifndef setcpu
120 #define needcpu(x)
121 #define setcpu(x)
122 #define cpuwarn()
123 #endif
124 
125