annotate src/lwasm.h @ 21:3c0e5f311c95

Added reading of input file for pass1
author lost
date Fri, 02 Jan 2009 00:43:06 +0000
parents 05d4115b4860
children d2e86babd958
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
57495da01900 Initial checking of LWASM
lost
parents:
diff changeset
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
57495da01900 Initial checking of LWASM
lost
parents:
diff changeset
22
57495da01900 Initial checking of LWASM
lost
parents:
diff changeset
23
57495da01900 Initial checking of LWASM
lost
parents:
diff changeset
24 #ifndef __lwasm_h_seen__
57495da01900 Initial checking of LWASM
lost
parents:
diff changeset
25 #define __lwasm_h_seen__
57495da01900 Initial checking of LWASM
lost
parents:
diff changeset
26
57495da01900 Initial checking of LWASM
lost
parents:
diff changeset
27 #define OUTPUT_DECB 0 // DECB multirecord format
57495da01900 Initial checking of LWASM
lost
parents:
diff changeset
28 #define OUTPUT_RAW 1 // raw sequence of bytes
21
3c0e5f311c95 Added reading of input file for pass1
lost
parents: 13
diff changeset
29 #define OUTPUT_OBJ 2 // proprietary object file format
3c0e5f311c95 Added reading of input file for pass1
lost
parents: 13
diff changeset
30
3c0e5f311c95 Added reading of input file for pass1
lost
parents: 13
diff changeset
31 // structure for keeping track of lines
3c0e5f311c95 Added reading of input file for pass1
lost
parents: 13
diff changeset
32 typedef struct lwasm_line_s lwasm_line_t;
3c0e5f311c95 Added reading of input file for pass1
lost
parents: 13
diff changeset
33 struct lwasm_line_s {
3c0e5f311c95 Added reading of input file for pass1
lost
parents: 13
diff changeset
34 char *text; // the actual text of the line
3c0e5f311c95 Added reading of input file for pass1
lost
parents: 13
diff changeset
35 int lineno; // line number within the file
3c0e5f311c95 Added reading of input file for pass1
lost
parents: 13
diff changeset
36 char *filename; // file name reference
3c0e5f311c95 Added reading of input file for pass1
lost
parents: 13
diff changeset
37 lwasm_line_t *next; // next line
3c0e5f311c95 Added reading of input file for pass1
lost
parents: 13
diff changeset
38 lwasm_line_t *prev; // previous line
3c0e5f311c95 Added reading of input file for pass1
lost
parents: 13
diff changeset
39 };
0
57495da01900 Initial checking of LWASM
lost
parents:
diff changeset
40
57495da01900 Initial checking of LWASM
lost
parents:
diff changeset
41 // keep track of current assembler state
57495da01900 Initial checking of LWASM
lost
parents:
diff changeset
42 typedef struct {
13
05d4115b4860 Started work on new expression evaluator system and major code re-work for next release
lost
parents: 4
diff changeset
43 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
44 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
45 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
46 int passnum; // which pass are we on?
21
3c0e5f311c95 Added reading of input file for pass1
lost
parents: 13
diff changeset
47 int execaddr; // execution address for the program (END ....)
3c0e5f311c95 Added reading of input file for pass1
lost
parents: 13
diff changeset
48 int pragmas; // what pragmas are in effect?
3c0e5f311c95 Added reading of input file for pass1
lost
parents: 13
diff changeset
49
3c0e5f311c95 Added reading of input file for pass1
lost
parents: 13
diff changeset
50 lwasm_line_t *lineshead; // first line of source code
3c0e5f311c95 Added reading of input file for pass1
lost
parents: 13
diff changeset
51 lwasm_line_t *linestail; // last line of source code
3c0e5f311c95 Added reading of input file for pass1
lost
parents: 13
diff changeset
52
13
05d4115b4860 Started work on new expression evaluator system and major code re-work for next release
lost
parents: 4
diff changeset
53 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
54 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
55 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
56 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
57 int outformat; // output format type
21
3c0e5f311c95 Added reading of input file for pass1
lost
parents: 13
diff changeset
58 char **filelist; // files that have been read
3c0e5f311c95 Added reading of input file for pass1
lost
parents: 13
diff changeset
59 int filelistlen; // number of files in the list
0
57495da01900 Initial checking of LWASM
lost
parents:
diff changeset
60 } asmstate_t;
57495da01900 Initial checking of LWASM
lost
parents:
diff changeset
61
57495da01900 Initial checking of LWASM
lost
parents:
diff changeset
62 #define PRAGMA_NOINDEX0TONONE 1
57495da01900 Initial checking of LWASM
lost
parents:
diff changeset
63
57495da01900 Initial checking of LWASM
lost
parents:
diff changeset
64 #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
65 //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
66 //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
67 //extern void list_symbols(asmstate_t *as, FILE *f);
0
57495da01900 Initial checking of LWASM
lost
parents:
diff changeset
68 #endif
57495da01900 Initial checking of LWASM
lost
parents:
diff changeset
69
57495da01900 Initial checking of LWASM
lost
parents:
diff changeset
70
57495da01900 Initial checking of LWASM
lost
parents:
diff changeset
71 #endif //__lwasm_h_seen__