Shop OBEX P1 Docs P2 Docs Learn Events
pasm RES directive — Parallax Forums

pasm RES directive

agfaagfa Posts: 295
edited 2009-04-10 03:44 in Propeller 1
If·more than 1 long is reserved for a variable (symbol), what syntax is used to address the 3 longs?

example:
m·· ·res· ·3

I tried m[noparse][[/noparse]0]...m[noparse][[/noparse]2] but no luck.

Comments

  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2009-04-10 02:26
    res is only for assembly programs, since it reserves memory in the cog, not the hub. For Spin and other hub variables, you have to use long.

    -Phil
  • agfaagfa Posts: 295
    edited 2009-04-10 03:05
    Thanks Phil,

    I am trying to understand it's use in assembly.· If I understand correctly, the following line reserves one long addressed as "m".

    m·· res· 1

    how would additional longs be addressed if more than one long were reserved?
  • Mike GreenMike Green Posts: 23,101
    edited 2009-04-10 03:27
    You can use the addresses m+1, m+2, and m+3 to access the additional longs. If you want to use some kind of indexing, that's a completely different question. For that, you have to actually modify the instruction that you're using to access the additional longs. You'd have to show what you're trying to do. I believe there are some examples in some of the Prop Assembly for Beginners threads.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2009-04-10 03:32
    This is usually done with self-modifing code:

            movs    loader,#m      'Initialize pointer
            ...
    loader  mov     register,0-0     'Load register with contents of array m.
            add     loader ,#1       'Increment pointer into m.
            ...
    
    
    


    -Phil
  • agfaagfa Posts: 295
    edited 2009-04-10 03:44
    Mike,
    thanks,·thats what i was looking for.

    Phil,
    thanks for the example.

    agfa
Sign In or Register to comment.