X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=as%2Fxa51%2Fxa_main.h;h=2b1da79712a03511a459ec159ed77eec43e5a86e;hb=22ec133e94d056a395025c302b6c331c8cd04658;hp=6a9cc14f7b9953d0e5e54828f9b67a972bb1f91e;hpb=83bb71bdbe106f49eb2bbdd3f544b527d781dbb8;p=fw%2Fsdcc diff --git a/as/xa51/xa_main.h b/as/xa51/xa_main.h index 6a9cc14f..2b1da797 100644 --- a/as/xa51/xa_main.h +++ b/as/xa51/xa_main.h @@ -1,3 +1,20 @@ +/* xa_main.h - Paul's XA51 Assembler + + Copyright 1997,2002 Paul Stoffregen (paul at pjrc dot com) + +This program is free software; you can redistribute it and/or modify it +under the terms of the GNU General Public License as published by the +Free Software Foundation; either version 3, or (at your option) any +later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . */ + #define SIZE8 0 #define SIZE16 1 #define SIZE32 2 @@ -32,7 +49,12 @@ struct symbol { int isdef; /* 1 if defined, 0 if no value yet */ int line_def; /* line in which is was defined */ int isbit; /* 1 if a bit address, 0 otherwise */ + int issfr; int isreg; /* 1 if a register, 0 otehrwise */ + int global ; /* is defined as global */ + char mode; /* Absolute, Relative, Tmplabel, eXternal */ + short lk_index; /* symbol index for the linker */ + int area; /* the area that this symbol is in */ struct symbol *next; }; /* a list of all the symbols that are branch targets */ @@ -43,25 +65,31 @@ struct target { struct target *next; }; struct area_struct { + int start; int alloc_position; + int defsEmitted; + int size; }; extern int current_area; #define MEM_POS (area[current_area].alloc_position) -#define AREA_CSEG 0 -#define AREA_DSEG 1 -#define AREA_OSEG 2 -#define AREA_ISEG 3 -#define AREA_BSEG 4 -#define AREA_XSEG 5 -#define AREA_XISEG 6 -#define AREA_XINIT 7 -#define AREA_GSINIT 8 -#define AREA_GSFINAL 9 -#define AREA_HOME 10 -#define NUM_AREAS 11 +enum { + AREA_CSEG=1, + AREA_DSEG, + // AREA_OSEG, + // AREA_ISEG, + AREA_BSEG, + AREA_XSEG, + AREA_XISEG, + AREA_XINIT, + AREA_GSINIT, + AREA_GSFINAL, + AREA_HOME, + AREA_SSEG, + NUM_AREAS=AREA_SSEG +}; extern struct area_struct area[NUM_AREAS]; @@ -71,13 +99,47 @@ extern int lineno; extern int p1, p2, p3, mem, m_len; extern struct symbol * build_sym_list(char *thename); -extern int assign_value(char *thename, int thevalue); -extern int mk_bit(char *thename); +extern int assign_value(char *thename, int thevalue, char mode); +extern int mk_bit(char *thename, int current_area); extern int mk_reg(char *thename); extern void out(int *byte_list, int num); extern int is_target(char *thename); extern void pad_with_nop(); extern int binary2int(char *str); -extern int is_def(char *thename); +extern int is_bit(char *thename); +extern int is_reg(char *thename); +extern struct symbol * is_def(char *thename); +extern struct symbol * is_ref(char *thename); extern int get_value(char *thename); - +extern struct symbol *findSymbol (char *thename); +extern char rel_line[2][132]; +extern char operand[2][MAX_SYMBOL]; +extern void error(char*); +int mk_bit(char*, int); +int mk_sfr(char*); +int mk_global(char*); +struct target * build_target_list(char *thename); +struct symbol * build_sym_list(char *); +int find_size_reg(int op1spec); +int find_size0(int isize); +int find_size1(int isize, int op1spec); +int find_size2(int isize, int op1spec, int op2spec); +int yyerror(char *s); +int imm_data4_signed(int value); +int imm_data4_unsigned(int value); +int imm_data5_unsigned(int value); +int imm_data8(int value); +int imm_data16(int value); +int reg(int reg_spec); +int reg_indirect(int reg_spec); +int lsb(int value); +int msb(int value); +int direct_addr(int value); +int bit_addr(int value); +int rel16(int pos, int dest); +int rel8(int pos, int dest); +char *areaToString (int area); + +FILE *frel, *fmem, *list_fp, *sym_fp; + +extern void relout();