Mercurial > hg-old > index.cgi
annotate src/lwasm.h @ 32:9bd0fbfe7405
Added basic indexed mode handling
author | lost |
---|---|
date | Fri, 02 Jan 2009 04:22:39 +0000 |
parents | c0ff62e5ad39 |
children | 538e15927776 |
rev | line source |
---|---|
0 | 1 /* |
4
34568fab6058
Fixed package to include all required files; also added copyright preamble to all source files
lost
parents:
0
diff
changeset
|
2 lwasm.h |
34568fab6058
Fixed package to include all required files; also added copyright preamble to all source files
lost
parents:
0
diff
changeset
|
3 Copyright © 2008 William Astle |
34568fab6058
Fixed package to include all required files; also added copyright preamble to all source files
lost
parents:
0
diff
changeset
|
4 |
34568fab6058
Fixed package to include all required files; also added copyright preamble to all source files
lost
parents:
0
diff
changeset
|
5 This file is part of LWASM. |
34568fab6058
Fixed package to include all required files; also added copyright preamble to all source files
lost
parents:
0
diff
changeset
|
6 |
34568fab6058
Fixed package to include all required files; also added copyright preamble to all source files
lost
parents:
0
diff
changeset
|
7 LWASM is free software: you can redistribute it and/or modify it under the |
34568fab6058
Fixed package to include all required files; also added copyright preamble to all source files
lost
parents:
0
diff
changeset
|
8 terms of the GNU General Public License as published by the Free Software |
34568fab6058
Fixed package to include all required files; also added copyright preamble to all source files
lost
parents:
0
diff
changeset
|
9 Foundation, either version 3 of the License, or (at your option) any later |
34568fab6058
Fixed package to include all required files; also added copyright preamble to all source files
lost
parents:
0
diff
changeset
|
10 version. |
34568fab6058
Fixed package to include all required files; also added copyright preamble to all source files
lost
parents:
0
diff
changeset
|
11 |
34568fab6058
Fixed package to include all required files; also added copyright preamble to all source files
lost
parents:
0
diff
changeset
|
12 This program is distributed in the hope that it will be useful, but WITHOUT |
34568fab6058
Fixed package to include all required files; also added copyright preamble to all source files
lost
parents:
0
diff
changeset
|
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
34568fab6058
Fixed package to include all required files; also added copyright preamble to all source files
lost
parents:
0
diff
changeset
|
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for |
34568fab6058
Fixed package to include all required files; also added copyright preamble to all source files
lost
parents:
0
diff
changeset
|
15 more details. |
34568fab6058
Fixed package to include all required files; also added copyright preamble to all source files
lost
parents:
0
diff
changeset
|
16 |
34568fab6058
Fixed package to include all required files; also added copyright preamble to all source files
lost
parents:
0
diff
changeset
|
17 You should have received a copy of the GNU General Public License along with |
34568fab6058
Fixed package to include all required files; also added copyright preamble to all source files
lost
parents:
0
diff
changeset
|
18 this program. If not, see <http://www.gnu.org/licenses/>. |
34568fab6058
Fixed package to include all required files; also added copyright preamble to all source files
lost
parents:
0
diff
changeset
|
19 |
34568fab6058
Fixed package to include all required files; also added copyright preamble to all source files
lost
parents:
0
diff
changeset
|
20 Contains the main defs used by the assembler |
34568fab6058
Fixed package to include all required files; also added copyright preamble to all source files
lost
parents:
0
diff
changeset
|
21 */ |
0 | 22 |
23 | |
24 #ifndef __lwasm_h_seen__ | |
25 #define __lwasm_h_seen__ | |
26 | |
27 #define OUTPUT_DECB 0 // DECB multirecord format | |
28 #define OUTPUT_RAW 1 // raw sequence of bytes | |
21 | 29 #define OUTPUT_OBJ 2 // proprietary object file format |
30 | |
26 | 31 // structure for tracking errors |
32 typedef struct lwasm_error_s lwasm_error_t; | |
33 struct lwasm_error_s | |
34 { | |
35 char *mess; // the actual error message | |
36 lwasm_error_t *next; // ptr to next error | |
37 }; | |
38 | |
21 | 39 // structure for keeping track of lines |
40 typedef struct lwasm_line_s lwasm_line_t; | |
41 struct lwasm_line_s { | |
42 char *text; // the actual text of the line | |
43 int lineno; // line number within the file | |
44 char *filename; // file name reference | |
45 lwasm_line_t *next; // next line | |
46 lwasm_line_t *prev; // previous line | |
26 | 47 lwasm_error_t *err; // error messages |
28 | 48 int fsize; // forced size (0 = no forced size) |
21 | 49 }; |
0 | 50 |
51 // keep track of current assembler state | |
52 typedef struct { | |
13
05d4115b4860
Started work on new expression evaluator system and major code re-work for next release
lost
parents:
4
diff
changeset
|
53 int dpval; // current dp value (setdp) |
05d4115b4860
Started work on new expression evaluator system and major code re-work for next release
lost
parents:
4
diff
changeset
|
54 int addr; // current address |
05d4115b4860
Started work on new expression evaluator system and major code re-work for next release
lost
parents:
4
diff
changeset
|
55 int errorcount; // error count |
05d4115b4860
Started work on new expression evaluator system and major code re-work for next release
lost
parents:
4
diff
changeset
|
56 int passnum; // which pass are we on? |
21 | 57 int execaddr; // execution address for the program (END ....) |
58 int pragmas; // what pragmas are in effect? | |
59 | |
60 lwasm_line_t *lineshead; // first line of source code | |
61 lwasm_line_t *linestail; // last line of source code | |
62 | |
13
05d4115b4860
Started work on new expression evaluator system and major code re-work for next release
lost
parents:
4
diff
changeset
|
63 const char *infile; // input file |
05d4115b4860
Started work on new expression evaluator system and major code re-work for next release
lost
parents:
4
diff
changeset
|
64 const char *outfile; // output file |
05d4115b4860
Started work on new expression evaluator system and major code re-work for next release
lost
parents:
4
diff
changeset
|
65 const char *listfile; // output listing file |
05d4115b4860
Started work on new expression evaluator system and major code re-work for next release
lost
parents:
4
diff
changeset
|
66 int debug; // debug mode |
05d4115b4860
Started work on new expression evaluator system and major code re-work for next release
lost
parents:
4
diff
changeset
|
67 int outformat; // output format type |
21 | 68 char **filelist; // files that have been read |
69 int filelistlen; // number of files in the list | |
0 | 70 } asmstate_t; |
71 | |
72 #define PRAGMA_NOINDEX0TONONE 1 | |
73 | |
26 | 74 #ifndef __lwasm_c_seen__ |
75 #define __lwasm_E__ extern | |
76 #else | |
77 #define __lwasm_E__ | |
78 #endif | |
79 | |
80 __lwasm_E__ int register_error(asmstate_t *as, lwasm_line_t *l, int pass, const char *fmt, ...); | |
81 | |
27
f736579569b4
Added handlers for inherent and register to register instructions
lost
parents:
26
diff
changeset
|
82 __lwasm_E__ void lwasm_emit(asmstate_t *as, lwasm_line_t *l, int b); |
f736579569b4
Added handlers for inherent and register to register instructions
lost
parents:
26
diff
changeset
|
83 __lwasm_E__ void lwasm_emitop(asmstate_t *as, lwasm_line_t *l, int o); |
f736579569b4
Added handlers for inherent and register to register instructions
lost
parents:
26
diff
changeset
|
84 __lwasm_E__ int lwasm_lookupreg2(const char *reglist, char **str); |
32 | 85 __lwasm_E__ int lwasm_lookupreg3(const char *rlist, const char **str); |
27
f736579569b4
Added handlers for inherent and register to register instructions
lost
parents:
26
diff
changeset
|
86 |
26 | 87 #undef __lwasm_E__ |
88 | |
89 | |
0 | 90 #ifndef __symtab_c_seen__ |
13
05d4115b4860
Started work on new expression evaluator system and major code re-work for next release
lost
parents:
4
diff
changeset
|
91 //extern void register_symbol(asmstate_t *as, sourceline_t *cl, char *symstr, int val, int flags); |
05d4115b4860
Started work on new expression evaluator system and major code re-work for next release
lost
parents:
4
diff
changeset
|
92 //extern int lookup_symbol(asmstate_t *as, char *symstr); |
05d4115b4860
Started work on new expression evaluator system and major code re-work for next release
lost
parents:
4
diff
changeset
|
93 //extern void list_symbols(asmstate_t *as, FILE *f); |
0 | 94 #endif |
95 | |
96 | |
97 #endif //__lwasm_h_seen__ |