Shop OBEX P1 Docs P2 Docs Learn Events
Trouble assigning label address to IJMP1 Interrupt — Parallax Forums

Trouble assigning label address to IJMP1 Interrupt

I'm playing with assigning an ISR. A snippet of the p2asm is complaining with

main.p2asm:464: error: Source operand too big for mov

and am struggling to understand why. I mean, the label address can't be bigger than a long, right?

457 LR__0001
458 rdpin local14, local06
459 LR__0002
460 wrpin local07, local14
461 getct local13
462 reti1
463 LR__0003
464 mov ijmp1, #LR__0001

Comments

  • MOV can only move 9-bit immediates (i.e. only cog ram addresses). Use either the double ## syntax or use a LOC to get the address first and then MOV it into IJMPx. The latter is preferable because it's position-independent.

  • Thanks, @Wuerfel_21. Tried the ## just to test. Still get the same error. Doesn't that expand the arg to 32 bit?

    It did compile with the LOC added and that seems to be what I want from reading the Assembly Language manual. Is there some convention on how or when to use PTRA and PTRB or are they pretty much open to use as one sees fit?

  • ## should always work. idk why it wouldn't.

    There is no convention, other that you should not touch PTRA in inline ASM. Do note that you can also use the PA and PB registers with LOC, which is usually a better idea.

  • @Wuerfel_21 said:
    ## should always work. idk why it wouldn't.

    There is no convention, other that you should not touch PTRA in inline ASM. Do note that you can also use the PA and PB registers with LOC, which is usually a better idea.

    Interesting. I don't think so in this case, but it might be possible that PA or PB is in use by another call, right? So is the safe action to push the current value to stack, do my operation, then pop it back?

  • PA/PB are usually used as scratch registers. Really depends on what you're actually doing.

Sign In or Register to comment.