view old-trunk/lwasm/old/pass2.c @ 339:eb230fa7d28e

Prepare for migration to hg
author lost
date Fri, 19 Mar 2010 02:54:14 +0000
parents
children
line wrap: on
line source

/*
pass2.c
Copyright © 2009 William Astle

This file is part of LWASM.

LWASM 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 of the License, 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 <http://www.gnu.org/licenses/>.


Handles second pass of assembly

*/

#include <config.h>

#include "lwasm.h"

void lwasm_pass2(asmstate_t *as)
{
	lwasm_line_t *l;
	sectiontab_t *st;
	
	debug_message(1, "Entering pass 2");
	as -> passnum = 2;
	as -> addr = 0;
	as -> context = 0;
	as -> endseen = 0;
	as -> skipcond = 0;
	as -> skipcount = 0;
	as -> skipmacro = 0;
	as -> inmacro = 0;
	as -> nextcontext = 1;
	as -> skiplines = 0;
	as -> dpval = 0;
	as -> inmod = 0;
	
	for (st = as -> sections; st; st = st -> next)
		st -> offset = 0;
	as -> csect = NULL;
	
	// iterate over all the lines and re-parse them
	for (l = as -> lineshead; l && !(as -> endseen); l = l -> next)
	{
		if (as -> skiplines)
			as -> skiplines--;
		else
			lwasm_parse_line(as, l);
	}
}