Added basic support for .area and .ds directives to the xa51 assembler.
[fw/sdcc] / as / xa51 / xa_main.h
1 #define SIZE8 0
2 #define SIZE16 1
3 #define SIZE32 2
4 #define UNKNOWN -1
5 #define WORD_REG 16384
6 #define BYTE_REG 32768
7
8 /* max # of bytes in db directive */
9 #define MAX_DB          2500
10
11 /* max # char in symbol name */
12 #define MAX_SYMBOL      1024
13
14 /* max # of bytes per line */
15 #define MAX_LINE        4096
16
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))
23
24 #define NOP_OPCODE 0    /* opcode for NOP */
25
26 /* a linked list of all the symbols */
27
28 struct symbol {
29         char *name;
30         int value;
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 */
35         int isreg;      /* 1 if a register, 0 otehrwise */
36         struct symbol *next; };
37
38 /* a list of all the symbols that are branch targets */
39 /* (and will need to get aligned on 4 byte boundries) */
40
41 struct target {
42         char *name;
43         struct target *next; };
44
45 struct area_struct {
46         int alloc_position;
47 };
48
49 extern int current_area;
50
51 #define MEM_POS (area[current_area].alloc_position)
52
53 #define AREA_CSEG       0
54 #define AREA_DSEG       1
55 #define AREA_OSEG       2
56 #define AREA_ISEG       3
57 #define AREA_BSEG       4
58 #define AREA_XSEG       5
59 #define AREA_XISEG      6
60 #define AREA_GSINIT     7
61 #define AREA_GSFINAL    8
62 #define AREA_HOME       9
63 #define NUM_AREAS       10
64
65 extern struct area_struct area[NUM_AREAS];
66
67 extern FILE *yyin;
68 extern char *yytext;
69 extern int lineno;
70 extern int p1, p2, p3, mem, m_len;
71
72 extern struct symbol * build_sym_list(char *thename);
73 extern int assign_value(char *thename, int thevalue);
74 extern int mk_bit(char *thename);
75 extern int mk_reg(char *thename);
76 extern void out(int *byte_list, int num);
77 extern int is_target(char *thename);
78 extern void pad_with_nop();
79 extern int binary2int(char *str);
80 extern int is_def(char *thename);
81 extern int get_value(char *thename);
82