#105 incomplete #v substitution support

None
closed
Borut Ražem
None
5
2012-11-01
2005-08-02
robert Carter
No

Hi
I'm a newbe to this app, so this may have been reported,
appologies if it has:

If I try to assemble:

        list    c=132,p=16f874A
        __config    01f7dh
        noexpand
        include "P16F874A.INC"

#define     off 0
#define     on  1
#define     sol_beer3   portc,4
#define     sol_beer2   portc,6
#define     sol_beer4   portc,7
#define     sol_beer1   portd,4

keg_line    macro   arg1, arg2
        if arg2 == on
        bsf sol_beer#v(arg1)
        else
        bcf sol_beer#v(arg1)
        endif
        endm

        org 0
        keg_line 1, off
        end

I get error 128 missing arguments, but it assembles fine
in mpasm, the mising argument appears to be at "bsf
sol_beer#v(arg1)"

can anyone help with this?
regards
rob carter
rob.carter@karterelectronic.com

Discussion

  • Logged In: NO

    gpasm doesn't handle macros as well as mpasm. I doubt
    gpasm is unrolling the #define after the macro is
    processed. I suspect the #define's are being processed in
    the same pass as the macro which means sol_beer1 doesn't
    exist when the #define for sol_beer1 is being processed.
    I've had similar problems with gpasm and trying to use
    advanced(complex) macros. In the end I had to make
    workarounds.

     
  • David Barnett
    David Barnett
    2007-03-17

    Logged In: YES
    user_id=896846
    Originator: NO

    I don't think the problem has anything to do with the macro. You still get the same failure for this:

      list p=16f874a
      #include "p16f874a.inc"
    #define sol_beer3 PORTC, 4
    
      org 0
      bsf sol_beer#v(3)
      end
    

    I suspect the #v syntax was never properly implemented.

     
    Last edit: Borut Ražem 2012-10-16
  • David Barnett
    David Barnett
    2007-03-18

    Logged In: YES
    user_id=896846
    Originator: NO

    "Missing arguments" in this case comes from the context of the BSF instruction. It looks like there are a few issues at hand, but the immediate issue is that gpasm assumes that sol_beer#v(arg1) will be a single argument to BSF (the register argument, but not the bit offset).

    A more fundamental issue is that the #v syntax for gpasm currently only works for actual "symbols" and not defines. If sol_beer1 had been a symbol instead (as declared by "variable" or "EQU"), gpasm's assumption about the number of arguments would have been valid.

     
  • Borut Ražem
    Borut Ražem
    2012-10-16

    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -4,6 +4,7 @@
    
     If I try to assemble:
    
    +~~~~~~
            list    c=132,p=16f874A
            __config    01f7dh
            noexpand
    @@ -27,6 +28,7 @@
            org 0
            keg_line 1, off
            end
    +~~~~~~
     I get error 128 missing arguments, but it assembles fine 
     in mpasm, the mising argument appears to be at "bsf    
     sol_beer#v(arg1)"
    
    • milestone: --> None
     


Anonymous


Cancel   Add attachments