Linked list in pasm
Ray0665
Posts: 231
I am having difficulty with a linked list in PASM
The pasm routine is started from spin as follows
P1 := @L1
cognew(@begin,@P1)
In the PASM I fetch the starting address like this
DAT
ORG 0
Begin mov Ptr,par
rdlong NextPtr,Ptr ' Save the link
add Ptr,#4 ' Point to the data
<<< do stuff with data >>>>
and now I want to advance to the next element so I do this
mov Ptr,NextPtr
But it does not work where am I going wrong?
the list is defined like this, at the end of the DAT block
L1 long @L2, <data>
L2 long @L3, <data>
L3 Long @L1, <data>
The pasm routine is started from spin as follows
P1 := @L1
cognew(@begin,@P1)
In the PASM I fetch the starting address like this
DAT
ORG 0
Begin mov Ptr,par
rdlong NextPtr,Ptr ' Save the link
add Ptr,#4 ' Point to the data
<<< do stuff with data >>>>
and now I want to advance to the next element so I do this
mov Ptr,NextPtr
But it does not work where am I going wrong?
the list is defined like this, at the end of the DAT block
L1 long @L2, <data>
L2 long @L3, <data>
L3 Long @L1, <data>
Comments
for example could I define the links like this
L1 long @L2+begin,<data> where begin is the first label
having your List with offsets instead of Addresses
L1 long @L2-@L1, <data>
L2 long @L3-@L1, <data>
L3 Long @L1-@L1, <data>
Enjoy!
Mike