Shop OBEX P1 Docs P2 Docs Learn Events
pointer question — Parallax Forums

pointer question

OK I can use ptra for example, to read hub ram indexed into my cog
rdlong a, ptra++
rdlong b, ptra++
rdlong c, ptra++

is there a pointer usable in cog ram to do the same? Or do I need self modifying code to do that?

my goal would be something like
xxx:=@a
rep #1,#3
rdlong xxx++, ptra++

or something like that to index cogram in a loop

curious,

Mike


Comments

  • Use the ALTI instruction to modify D and increment.
  • msrobotsmsrobots Posts: 3,709
    edited 2019-01-28 02:45
    ozpropdev wrote: »
    Use the ALTI instruction to modify D and increment.

    ahh, thanks, that will work.

    This pasm2 is a beast, but a friendly one. I already like it a lot.

    edit:

    I just needed altd and alts but works like a charm saved ~20 longs, cool

    Enjoy!

    Mike
  • Also, if you're doing a block read, you can use SETQ with RDLONG to do the read in just two instructions, and potentially faster (one long copied per clock cycle) if the hub FIFO is not in use.
Sign In or Register to comment.