FlexGui P2ASM Local Labels

I'm using FlexGui with the __pasm directive to implement P2ASM.
__pasm {
     ...
}
Does FlexC allow local labels? I can't get it to work using either colon or dot notation.

Comments

  • Yes, FlexC allows local labels, using whatever form (colon or dot) is appropriate for the processor being compiled for (colon for P1, dot for P2). For example:
    #include <propeller2.h>
    
    __pasm {
    entry
        nop
    .somelocal
        dirnot #56
        waitx ##20_000_000
        jmp #.somelocal
    bar
    }
    
    int main () {
    
       _cognew(&entry, 0);
       for(;;)
           ;
       return(0);
    } 
    
  • @ersmith,

    Now local labels don't work. I get the following messages.
    "C:/tools/PropellerTools/flexgui/bin/fastspin" -2 -l -O1 -I "C:/Projects/Prop2Test/flexgui/include"  "C:/Projects/Prop2Posit/PositTest.c"
    Propeller Spin/PASM Compiler 'FastSpin' (c) 2011-2019 Total Spectrum Software Inc.
    Version 4.0.5 Compiled on: Dec 19 2019
    PositTest.c
    Posit32es2.p2asm:664: error: syntax error, unexpected constant
    Posit32es2.p2asm:672: error: syntax error, unexpected '.'
    Posit32es2.p2asm:676: error: syntax error, unexpected '.'
    child process exited abnormally
    Finished at Tue Jan 14 14:13:19 2020
    

    Code follows:
    659                     mov     temp1,#quire_msw
    660                     sets    .0,temp1
    661                     mov     cntr1,#16
    662                     mov     k_expA,#271
    663
    664     .0              mov     frac64Ah,#0 wz
    665             if_z    sub     temp1,#1
    666             if_z    sets    .0,temp1
    667             if_z    sub     k_expA,#32
    668             if_z    djnz    cntr1,#.0
    669
    670                     ' Copy next 2 words to frac64A l and x
    671
    672                     sets    .A1,temp1
    673                     sub     temp1,#1
    674                     sets    .2,temp1
    675
    676     .A1             mov     frac64Al,frac64Al
    677     .2              mov     frac64Ax,frac64Ax
    
  • Ah, I see: it doesn't like ".0" and ".2" (it wants the local labels to start with a letter or underscore). Does PNut allow local labels to start with a digit? I'd kind of be surprised if it does, those look like floating point numbers, but I'll go along with whatever Chip does.
  • MSwannMSwann Posts: 20
    edited 2020-01-14 - 22:55:02
    ersmith wrote: »
    Ah, I see: it doesn't like ".0" and ".2" (it wants the local labels to start with a letter or underscore). Does PNut allow local labels to start with a digit? I'd kind of be surprised if it does, those look like floating point numbers, but I'll go along with whatever Chip does.
    I changed all labels to DOT-ALPHA. Here are the results
    "C:/tools/PropellerTools/flexgui/bin/fastspin" -2 -l -O1 -I "C:/Projects/Prop2Test/flexgui/include"  "C:/Projects/Prop2Posit/PositTest.c"
    Propeller Spin/PASM Compiler 'FastSpin' (c) 2011-2019 Total Spectrum Software Inc.
    Version 4.0.5 Compiled on: Dec 19 2019
    PositTest.c
    Posit32es2.p2asm:660: error: syntax error, unexpected '.'
    Posit32es2.p2asm:664: error: syntax error, unexpected '.'
    Posit32es2.p2asm:666: error: syntax error, unexpected '.'
    Posit32es2.p2asm:668: error: syntax error, unexpected '.'
    Posit32es2.p2asm:672: error: syntax error, unexpected '.'
    Posit32es2.p2asm:674: error: syntax error, unexpected '.'
    child process exited abnormally
    Finished at Tue Jan 14 14:47:03 2020
    

    Code follows:
    659                     mov     temp1,#quire_msw
    660                     sets    .A,temp1
    661                     mov     cntr1,#16
    662                     mov     k_expA,#271
    663
    664     .A              mov     frac64Ah,#0 wz
    665             if_z    sub     temp1,#1
    666             if_z    sets    .A,temp1
    667             if_z    sub     k_expA,#32
    668             if_z    djnz    cntr1,#.A
    669
    670                     ' Copy next 2 words to frac64A l and x
    671
    672                     sets    .B,temp1
    673                     sub     temp1,#1
    674                     sets    .C,temp1
    675
    676     .B              mov     frac64Al,frac64Al
    677     .C              mov     frac64Ax,frac64Ax
    
  • Something weird is definitely going on, I was sure that I compiled and ran the program I posted earlier, but now I can't. I must have mixed up compiler versions or something. Sorry about that, I'll look into it. There must be a conflict between the C parser and the Spin parser in __pasm blocks.
  • OK, the bug seems to be in handling any single character local label in C code in P2 mode; a little specific and I missed it. Basically local labels have to start with two letters or underscores to be properly recognized in fastspin 4.0.x. It'll be fixed in 4.1.0.
Sign In or Register to comment.