Shop OBEX P1 Docs P2 Docs Learn Events
P2 PASM RDFAST — Parallax Forums

P2 PASM RDFAST

pic18f2550pic18f2550 Posts: 392
edited 2021-04-30 10:58 in Propeller 2

Hello,
I need a fast routine to load 64 long from HUBRAM to COGRAM.

I thought about rdfast.

var
  byte buf[64]

PUB main()
  coginit(COGEXEC_NEW, @code, @buf)

DAT org
code
        rdlong linebuf,ptra
        rdfast #64,linebuf '
        ........ Code ..........
        jmp #code
linebuf res 64

Is this correct?

Comments

  • cgraceycgracey Posts: 14,133
    edited 2021-03-25 15:30

    Why not just do:

            setq    #64-1
            rdlong  linebuff,ptra
    

    Also: long buf [64]

  • Btw, rdfast doesn't read anything, it sets up so you can normally use the'read fast' instructions rflong/rfword/rfbyte although the setq method is stacks simpler for reading in a buffer and super fast.

  • See the FAST BLOCK MOVES section in the doc.

  • evanhevanh Posts: 15,188

    @cgracey said:
    Why not just do:

    The main reason is he doesn't read/speak English. Has to translate what we tell him here. The docs don't translate well.

  • Found it.
    With this, reloading driver parts is child's play.

    SETQ #x 'x = number of longs, minus 1, to read
    RDLONG first_reg,S/#/PTRx 'read x+1 longs starting at first_reg

    What I still suspect is that "PTRx" must be used.
    As far as I know, PTRx is read-only.
    Is there another way to set 4 or more different values?

  • No, PTRx is not required in the RDLONG following SETQ, you can pick any register with an address to start reading from. If it is not PTRA or PTRB then you just won't get this register updated at the end of the transfer. i.e. this register's original value will be left intact, but the burst will still occur. This is the "RDLONG first_reg, S" case above, where S can be any non-PTRx register.

  • Thank you

Sign In or Register to comment.