gnupic: MACRO expanding with gpasm


Previous by date: 16 Nov 2001 23:46:10 -0000 Re: CUMP, James Newton. Admin 3
Next by date: 16 Nov 2001 23:46:10 -0000 Re: MACRO expanding with gpasm, Frederic
Previous in thread: 16 Nov 2001 23:46:10 -0000 MACRO expanding with gpasm, Frederic Mantegazza
Next in thread: 16 Nov 2001 23:46:10 -0000 Re: MACRO expanding with gpasm, Frederic

Subject: Re: MACRO expanding with gpasm
From: Craig Franklin ####@####.####
Date: 16 Nov 2001 23:46:10 -0000
Message-Id: <3BF5B3DA.E4BFCCE4@home.com>

When a macro is defined gpasm parses and stores it.  Each time the macro
is invoked this parsed structure is feed to opcode generator.  This
works fine for most macros, but it has some problems.  Your example
demonstrates the most common one.

These problems can be solved by storing the macro as text.  The text is
then injected into the first gpasm input stage, the lexer.  This method
resolves all of these problems.

I have had this basically working for over a month, but I haven't had
time to fix the last few bugs.  I will try to find the time and get it
fixed.

Frederic Mantegazza wrote:
> 
> Hello,
> 
> For my first PIC project, I would like to make a rotary encoder interface
> based on a 12C509, which will be read via I2C bus.
> 
> So, I started with the AN541, which describes the way to implement the I2C
> slave protocol, without SSP, using a 16C54 (hope it won't be to hard to
> switch to the 12C509).
> 
> But I have some troubles with gpasm. It seems that macro expanding doesn't
> work for the BIT macro (all others work):
> 
> BIT     MACRO   label,bit,file  ;Define a bit label
> label                            EQU    file<<8|bit             ;(macro)
>         ENDM                    ;
> 
> Every time using this macro, the following error occurs:
> 
> i2c.asm:114:Error [113] Symbol not previously defined (B_C).
> i2c.asm:55:Error [116] Value of symbol "label" differs on second pass
>  pass 1=0,  pass 2=768
> 
> The line 55 is the line where the BIT macro is defined, and the 114 line
> is:
> 
>         BIT     B_C,0,STATUS    ;Carry
> 
> where the B_C label is defined.
> 
> Do you have any idea why this macro doesn't expand correctly ?
> 
> --
>     Frederic
> 
>   ------------------------------------------------------------------------
>               Name: i2c.asm
>    i2c.asm    Type: Plain Text (text/plain)
>           Encoding: base64
> 
>   ------------------------------------------------------------------------
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ####@####.####
> For additional commands, e-mail: ####@####.####

Previous by date: 16 Nov 2001 23:46:10 -0000 Re: CUMP, James Newton. Admin 3
Next by date: 16 Nov 2001 23:46:10 -0000 Re: MACRO expanding with gpasm, Frederic
Previous in thread: 16 Nov 2001 23:46:10 -0000 MACRO expanding with gpasm, Frederic Mantegazza
Next in thread: 16 Nov 2001 23:46:10 -0000 Re: MACRO expanding with gpasm, Frederic


Powered by ezmlm-browse 0.20.