gnupic: Re: Global symbols in macros don't work in gpasm?


Previous by date: 10 Sep 2000 09:48:27 -0000 Re: gpsim - is the simulation of two connected PIC's possible?, Wojtek Zabolotny
Next by date: 10 Sep 2000 09:48:27 -0000 Re: Global symbols in macros don't work in gpasm? - DIRTY workoraund, Wojtek Zabolotny
Previous in thread:
Next in thread:

Subject: [PIC]: Global symbols in macros don't work in gpasm?
From: Wojtek Zabolotny ####@####.####
Date: 10 Sep 2000 09:48:27 -0000
Message-Id: <20000910114017.A1460@wzab.nasz.dom>

Hi All,

I have a problem with setting of global symbols in macros in gpasm.
Let's consider the following source:
=> test.asm <=
	list p=16f877
counter macro
x_cnt set x_cnt + 1
    	movlw x_cnt
  	endm

	org 0
x_cnt	set 0
	counter
	counter
	counter
	end
=> end of test.asm <=

Well it has no sense, but clearly demonstrates the problem. I'd expect
to get the following instructions assembled:
	movlw 1
	movlw 2
	movlw 3

But in fact I get the 
	movlw 2
	movlw 4
	movlw 6

It seems that each macro is evaluted TWICE =:-( ?!

The problem first appeared, when I tried to implement my macros supporting
the bank switching (see my post sent a few days ago "Macros for automatic
banks management - problems with gpasm").
[Now I've stated that the origin of that problem can be the same - repeated
evaluation of the macro. First pass modifies the xb_cur, and the second pass 
generates the incorrect code]

Where is the problem with gpasm's macros implementation and how to 
fix/workaround it?
-- 
			TIA & Greetings
			Wojciech Zabolotny
			http://www.ise.pw.edu.pl/~wzab

Build your free Data Acquisition System:
http://www.ise.pw.edu.pl/~wzab/picadc/picadc.html

Previous by date: 10 Sep 2000 09:48:27 -0000 Re: gpsim - is the simulation of two connected PIC's possible?, Wojtek Zabolotny
Next by date: 10 Sep 2000 09:48:27 -0000 Re: Global symbols in macros don't work in gpasm? - DIRTY workoraund, Wojtek Zabolotny
Previous in thread:
Next in thread:


Powered by ezmlm-browse 0.20.