comparison src/lwasm.h @ 74:c8c772ef5df9

Checkpointing object target implementation
author lost
date Thu, 08 Jan 2009 01:18:40 +0000
parents d5fe306f1ab1
children 92eb93bffa28
comparison
equal deleted inserted replaced
73:4b37f17624a7 74:c8c772ef5df9
29 29
30 #define OUTPUT_DECB 0 // DECB multirecord format 30 #define OUTPUT_DECB 0 // DECB multirecord format
31 #define OUTPUT_RAW 1 // raw sequence of bytes 31 #define OUTPUT_RAW 1 // raw sequence of bytes
32 #define OUTPUT_OBJ 2 // proprietary object file format 32 #define OUTPUT_OBJ 2 // proprietary object file format
33 #define OUTPUT_RAWREL 3 // raw bytes where ORG causes a SEEK in the file 33 #define OUTPUT_RAWREL 3 // raw bytes where ORG causes a SEEK in the file
34
35 // structure for tracking sections
36 #define SECTION_BSS 1 // the section contains no actual code - just uninit vars
37 typedef struct sectiontab_s sectiontab_t;
38 struct sectiontab_s
39 {
40 char *name; // name of the section
41 int offset; // current offset in the section
42 int flags; // section flags
43 sectiontab_t *next; // next section
44 };
34 45
35 // structure for tracking macros 46 // structure for tracking macros
36 typedef struct macrotab_s macrotab_t; 47 typedef struct macrotab_s macrotab_t;
37 struct macrotab_s 48 struct macrotab_s
38 { 49 {
67 int codeaddr; // address the code goes at 78 int codeaddr; // address the code goes at
68 int nocodelen; // for "RMB" type instructions 79 int nocodelen; // for "RMB" type instructions
69 int addrset; // set if this instruction sets the assembly address 80 int addrset; // set if this instruction sets the assembly address
70 int symaddr; // set if this instruction sets a symbol addr with EQU or the like 81 int symaddr; // set if this instruction sets a symbol addr with EQU or the like
71 int badop; // bad operation - ignore it 82 int badop; // bad operation - ignore it
83
84 // the following are used for obj format - for external references, inter-section
85 // references, and intrasection relocations
86 int relocoff; // offset into insn where relocation value goes
87 // the incomplete reference expression
88 struct lwasm_expr_strack_t *expr;
72 }; 89 };
73 90
74 // for keeping track of symbols 91 // for keeping track of symbols
75 #define SYMBOL_SET 1 // the symbol was used for "SET" 92 #define SYMBOL_SET 1 // the symbol was used for "SET"
76 #define SYMBOL_NORM 0 // no flags 93 #define SYMBOL_NORM 0 // no flags
116 int skipmacro; // skipping a macro? 133 int skipmacro; // skipping a macro?
117 int inmacro; // are we currently in a macro? 134 int inmacro; // are we currently in a macro?
118 int macroex; // current depth of macro expansion 135 int macroex; // current depth of macro expansion
119 int nextcontext; // next context number 136 int nextcontext; // next context number
120 int skiplines; // number of lines to skip 137 int skiplines; // number of lines to skip
138
139 // items used only for the "object" target
140 sectiontab_t *sections; // pointer to section table
141 sectiontab_t *csect; // current section - NULL if not in one
121 } asmstate_t; 142 } asmstate_t;
122 143
123 #define PRAGMA_NOINDEX0TONONE 1 144 #define PRAGMA_NOINDEX0TONONE 1
124 145
125 #ifndef __lwasm_c_seen__ 146 #ifndef __lwasm_c_seen__