339
|
1 /*
|
|
2 pass2.c
|
|
3 Copyright © 2009 William Astle
|
|
4
|
|
5 This file is part of LWASM.
|
|
6
|
|
7 LWASM is free software: you can redistribute it and/or modify it under the
|
|
8 terms of the GNU General Public License as published by the Free Software
|
|
9 Foundation, either version 3 of the License, or (at your option) any later
|
|
10 version.
|
|
11
|
|
12 This program is distributed in the hope that it will be useful, but WITHOUT
|
|
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
|
15 more details.
|
|
16
|
|
17 You should have received a copy of the GNU General Public License along with
|
|
18 this program. If not, see <http://www.gnu.org/licenses/>.
|
|
19
|
|
20
|
|
21 Handles second pass of assembly
|
|
22
|
|
23 */
|
|
24
|
|
25 #include <config.h>
|
|
26
|
|
27 #include "lwasm.h"
|
|
28
|
|
29 void lwasm_pass2(asmstate_t *as)
|
|
30 {
|
|
31 lwasm_line_t *l;
|
|
32 sectiontab_t *st;
|
|
33
|
|
34 debug_message(1, "Entering pass 2");
|
|
35 as -> passnum = 2;
|
|
36 as -> addr = 0;
|
|
37 as -> context = 0;
|
|
38 as -> endseen = 0;
|
|
39 as -> skipcond = 0;
|
|
40 as -> skipcount = 0;
|
|
41 as -> skipmacro = 0;
|
|
42 as -> inmacro = 0;
|
|
43 as -> nextcontext = 1;
|
|
44 as -> skiplines = 0;
|
|
45 as -> dpval = 0;
|
|
46 as -> inmod = 0;
|
|
47
|
|
48 for (st = as -> sections; st; st = st -> next)
|
|
49 st -> offset = 0;
|
|
50 as -> csect = NULL;
|
|
51
|
|
52 // iterate over all the lines and re-parse them
|
|
53 for (l = as -> lineshead; l && !(as -> endseen); l = l -> next)
|
|
54 {
|
|
55 if (as -> skiplines)
|
|
56 as -> skiplines--;
|
|
57 else
|
|
58 lwasm_parse_line(as, l);
|
|
59 }
|
|
60 }
|