Shop OBEX P1 Docs P2 Docs Learn Events
D/S PASM — Parallax Forums

D/S PASM

With the Prop 1, I was a Spin programmer who feasted upon the bounty of skilled PASM programmers. Unfortunately, the Prop 2 ecosystem is not there yet and I have dived into PASM.

Is the following correct? If D/S is an address (variable name) then that address points to the value used. If #D/S then the value entered (#$FF or #20) is used. I have no clue what ## means.

Thanks,
John Abshier

Comments

  • cgraceycgracey Posts: 14,133
    D is the data and S is the address for memory R/W instructions.

    S can be #0..$FF, ##0..$FFFFF, or a PTRA/PTRB expression.
  • D and S are the destination and source fields for a PASM instruction. They are 9 bits wide to address 512 longs of cog ram. # makes S a literal in the range 0-511. So ADD X,Y will fetch the two longs from cog addr X and Y, add them, and write the result to X. S can be a literal, so ADD X,#5 will add 5 to the value stored at X.

    P2 supports Hub execution so there are ways to refer S and D to a larger Hub address space, for example in fastspin where inline asm can use function local vatiables for S and D. There are also special instructions for reading and modifying S and D without affecting the rest of the instruction for self-modifying code.
  • I'd advise reading the documentation end to end twice, there's a lot of new stuff to take in. https://docs.google.com/document/d/1UnelI6fpVPHFISQ9vpLzOVa8oUghxpI6UpkXVsYgBEQ
  • RaymanRayman Posts: 13,860
    Fastspin seems to work for P2,
    If you'd rather not learn assembly...
Sign In or Register to comment.