Shop OBEX P1 Docs P2 Docs Learn Events
Continuing to the next line — Parallax Forums

Continuing to the next line

LuckyLucky Posts: 98
edited 2010-04-01 19:31 in Propeller 1
Does anyone know how to continue a lookup or lookdown table to the next line? When it starts to get too long in length, I press enter and continue the table on the next line, but at compile time, it says it expects an expression term on the first line and will not run.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
"You do not really understand something unless you can explain it to your grandmother."


-Lucky[size=-1][/size]

Comments

  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2010-03-31 21:43
    End the line with a {, and start the next line with a }. This comments out the carriage return.

    -Phil
  • LuckyLucky Posts: 98
    edited 2010-03-31 21:46
    Thats a neat trick, I never thought to comment out the extra space. Thank you

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "You do not really understand something unless you can explain it to your grandmother."


    -Lucky[size=-1][/size]
  • Jack BuffingtonJack Buffington Posts: 115
    edited 2010-04-01 04:09
    Along the same lines, I was about to post about lookup tables too... I know how to do it in a DAT section. It is like this for those of you searching about lookup tables:

    DAT
    gray32    byte  0,0,1,1,1,2,2,2,3,3,4,5,6,7,9,11,14,16,21,25,30,37,46,55,64,82,101,119,146,182,219,255
    
    



    What I would like to do is stick a lookup table into a VAR section without having to copy those values from the DAT section using code. My application is very tight on RAM/code space so it would be ideal to do something like this:

    VAR
    ' THIS DOESN'T WORK 
    long myLookupTable[noparse][[/noparse]10] = 1,2,3,4,5,6,7,8,9,10
    
    



    I would like to do this because I would like to pass the address of the lookup table to an assembly routine. I'm limited on space in the assembly routine too so I can't stick it there...

    Any ideas?

    -Jack
  • mparkmpark Posts: 1,305
    edited 2010-04-01 05:40
    You can pass the address of something in a DAT too; it doesn't have to be a VAR.
  • heaterheater Posts: 3,370
    edited 2010-04-01 19:31
    I would advise against using using the {} around new lines trick unless you really have to. It looks a mess.

    Why not just lay your tables out like this:

    DAT
    gray32    byte   0,   0,   1,   1,   1,   2,   2,   2
              byte   3,   3,   4,   5,   6,   7,   9,  11
              byte  14,  16,  21,  25,  30,  37,  46,  55
              byte  64,  82, 101, 119, 146, 182, 219, 255
    
    

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    For me, the past is not over yet.
Sign In or Register to comment.