Shop OBEX P1 Docs P2 Docs Learn Events
help following pointers — Parallax Forums

help following pointers

RtebRteb Posts: 3
edited 2011-02-22 09:19 in Propeller 1
I have a list defined in a dat as follows
l1 long @l2 <data>
l2 long @l3 <data>
l3 long @l....

I want to follow the links and code it as follows
p := @l1
...
' next link
p := long[p]

but this does not seem to work can anyone help?

Comments

  • TtailspinTtailspin Posts: 1,326
    edited 2011-02-22 07:35
    Hello Rteb,

    I am interested in Your code, could You please tell Me more?

    What will the code do when it is done?

    Thank You for Your time in this matter.
  • RtebRteb Posts: 3
    edited 2011-02-22 07:45
    The data section consists of a variable number of longs that represent a sequence of i/o patterns that will be sent to the I/o pins
    the first data long holds the count of items that follow the second data item is the delay between outputs, the remainder is the I/o pattern (not all 32 bits are always required)

    The entire list is a control sequence to test some other hardware
    there will be several control lists for various tests.
  • Mike GreenMike Green Posts: 23,101
    edited 2011-02-22 07:50
    It doesn't work because "@" in a DAT section doesn't store the absolute address. It stores the relative address. Read the Propeller Manual's description of "@" and "@@". The "p := @i1" does provide the absolute address. Your code should work if you use "p := @@ long[ p ]" since the "@@" converts the relative DAT address to absolute address.
  • RtebRteb Posts: 3
    edited 2011-02-22 07:52
    Thanks Mike I will try that this morning
  • Dave HeinDave Hein Posts: 6,347
    edited 2011-02-22 09:19
    You can used the @@@ operator in BST to store absolute addresses. Your DAT section would look like
    DAT
      t1 long @@@t2
      t2 long @@@t3
      t3 long @@@t...
    
Sign In or Register to comment.