Shop OBEX P1 Docs P2 Docs Learn Events
Is there an asynchronous longmove? — Parallax Forums

Is there an asynchronous longmove?

PerryPerry Posts: 253
edited 2011-03-28 18:21 in Propeller 1
I one is doing double-buffering how could one implement and an asynchronous longmove in spin/pasm?

like about 480 longs?
DAT
        org 0
AMOVE   cogid me

        mov    tempt,par
        rdlong source,par
        add    tempt,#4
        rdlong destination,par
        add    tempt,#4
        rdlong moving,tempt

aloop   rdlong source,tempt
        add    source,#4
        wrlong destination,tempt
        add    destination,#4
        djnz   moving,tempt
        cogstop me

me      res 1
tempt   res 1
source  res 1
destination res 1
moving  res 1

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2011-03-28 18:21
    No, there is no asynchronous longmove. You could do the move in a 2nd cog, but there's a 100us overhead in starting up another cog. The longmove itself is very fast ... about 32 clock cycles per move. That's under 400ns per move at 80MHz.

    You could dedicate a cog to moving longs around. It would check some hub locations for source and destination addresses and a count of the longs to be moved. You'd set the count to a non-zero value to start the copy operation and the move cog would zero the count when it was done. That would reduce the latency (for startup) considerably since the move cog would continue running, checking the count regularly.
Sign In or Register to comment.