Shop OBEX P1 Docs P2 Docs Learn Events
Thoughts on PA and PB — Parallax Forums

Thoughts on PA and PB

TonyB_TonyB_ Posts: 2,126
edited 2022-12-17 11:33 in Propeller 2

CALLPA and CALLPB are really useful instructions, particularly with XBYTE but also generally. So much so that PA and PB should be chosen as two of the main working registers whenever possible. If the P2 instruction set is extended in the future there is very little room for more D,S instructions but plenty of space for D-only, some of which could have an implicit S that is either PA or PB.

It might be possible to have D-only instructions with three operands D,SA,SB where SA,SB are both implicit and are either PA,PB or PTRA,PTRB.

EDIT:
Added 2nd paragraph.

Comments

  • evanhevanh Posts: 15,188
    edited 2022-12-16 21:58

    I've wanted a variant of those two instructions that also branch to immediate encoded lutRAM addresses. Which would of course chew up two more of the precious dual operand encoding slots.

  • Yea, lining up the CALLPx functions into the middle of the code space is a bit tricky...

  • @evanh said:
    I've wanted a variant of those two instructions that also branch to immediate encoded lutRAM addresses. Which would of course chew up two more of the precious dual operand encoding slots.

    Do you mean a JMP version? It's possible to branch to LUT RAM from cog RAM or vice-versa with CALLPx D,#S provided the jump is within range.

  • TonyB_TonyB_ Posts: 2,126
    edited 2022-12-16 22:52

    @Wuerfel_21 said:
    Yea, lining up the CALLPx functions into the middle of the code space is a bit tricky...

    To be fair this applies to other instructions such as TJxx & DJxx and there's always the register S option if all else fails.

  • A while back I found CALLPx was rather nice for high level languages as well, as a way to do far branching/calling when running from external memory. You can pass the destination branch address and call a jump handler in COGRAM as well AND it saves the caller's address on the stack for you too. :smile: You do need an AUGD as well for 32 bit constants.

    https://forums.parallax.com/discussion/comment/1535144/#Comment_1535144

    I should get back into that external memory stuff at some point too and maybe more GCC...

  • evanhevanh Posts: 15,188

    Huh, of course, AUGS does the lutRAM range. But then, for what I wanted, a MOV PA followed by a long CALL does the same.

  • It might be possible to have D-only instructions with three operands D,SA,SB where SA,SB are both implicit and are either PA,PB or PTRA,PTRB.

    Added to first post.

Sign In or Register to comment.