Shop OBEX P1 Docs P2 Docs Learn Events
ASM-blur Array question — Parallax Forums

ASM-blur Array question

CannibalRoboticsCannibalRobotics Posts: 535
edited 2008-12-19 22:42 in Propeller 1
I need a 256 byte array in a piece of prop assembly code. It's short and time critical application so I can't take any chances on the RDBYTE clock timing. I have room for a bunch of longs at the end in the cog RAM so I thought I would just REServe a bunch of longs at the end of my code and use them.

But, how do I reference anything past the first one.
Use for example a array tag named 'Slice'.

For example:

Loader                MOV      Slice, Sample                           ' This puts a 'Sample' into the address of Slice
                          Call       #Get_Sample                           ' Load next sample into 'Sample'
                          ADD      SliceNum,#1                             'Increment the Slice Index

                          MOV      (Slice + SliceNum), Sample       ' so how do I do this????
'
'
'
' Uninitialized Data

Sample    RES        1
SliceNum  RES      1
Slice        RES        256






I also need the inverse of reading the data back out of the array.
Thanks in advance.
JIm-

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Signature space for rent, only $1.
Send cash and signature to CannibalRobotics.

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2008-12-19 21:38
    Since there are no index registers in the Propeller, you have to use instruction modification. Here's a rough example:
              movd   :store,#Slice   ' Move the address of Slice into the instruction destination
              mov     count,#256     ' Number of samples to gather
    :Loop  Call     #Get_Sample
    :store  mov    0-0,Sample     ' Copy the sample value to the next array element
              add     :store,incr1     ' Add a constant that increments the address
              djnz    count,#:Loop
    
    incr1   long    $00000200      ' Add 1 to the 2nd 9 bit field (destination address)
    count  res      1
    slice   res      256
    
  • Mike GreenMike Green Posts: 23,101
    edited 2008-12-19 21:41
    To read the array back, you would use the source field address instead. The MOVS instruction does the same as the MOVD, but for the source field. Since the source address is in the least significant 9 bits of the instruction, you can use an immediate add of 1 to increment the source address instead of needing a separate constant as in the previous message.
  • CannibalRoboticsCannibalRobotics Posts: 535
    edited 2008-12-19 21:57
    You are Santa Claus.
    What is the "0-0" notation?

    Thanks Mike!

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Signature space for rent, only $1.
    Send cash and signature to CannibalRobotics.
  • Mike GreenMike Green Posts: 23,101
    edited 2008-12-19 22:07
    The "0-0" is just a placeholder that has the value zero. It usually implies that the address field will be modified at run-time.
  • CannibalRoboticsCannibalRobotics Posts: 535
    edited 2008-12-19 22:42
    Very cool language. The deeper I get into it the richer it becomes. It's a big mindset switch from the old 808x days of stacks registers and pointers.
    Thanks Again.
    J-

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Signature space for rent, only $1.
    Send cash and signature to CannibalRobotics.
Sign In or Register to comment.