Shop OBEX P1 Docs P2 Docs Learn Events
CALLing a local label? — Parallax Forums

CALLing a local label?

Nick MuellerNick Mueller Posts: 815
edited 2007-12-19 15:59 in Propeller 1
Hi!

when I do have some code that looks like this:
        org 0
SomeCode
        mov someReg, #0
        call #notSoMuch
        jmp SomeCode

notSoMuch
        nop
notSoMuch_ret
        ret

someReg res 1




... and change it to locals (eg: :someReg, etc), a call #:notSoMuch doesn't compile.
How does that make sense that calls only work with global labels?
Only workaround is using jmpret. Then I can use local labels.


Nick

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Never use force, just go for a bigger hammer!

The DIY Digital-Readout for mills, lathes etc.:
YADRO

Comments

  • deSilvadeSilva Posts: 2,967
    edited 2007-12-19 14:34
    CALL is a "macro", not an instruction. It has specific constraints, as needing ALWAYS the # and not accepting local labels.

    The idea behind "local labels" is a little bit obscure, I think they have been invented to simplify the patching for indexed addressing...
  • Nick MuellerNick Mueller Posts: 815
    edited 2007-12-19 14:44
    > CALL is a "macro", not an instruction.

    Well, it is a macro that does generate a jmpret. But jmpret *does* handle locals.


    > The idea behind "local labels" is a little bit obscure, ...

    What!? locals support the concept of scope. But ... OK, I shut up.


    Nick

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Never use force, just go for a bigger hammer!

    The DIY Digital-Readout for mills, lathes etc.:
    YADRO
  • CardboardGuruCardboardGuru Posts: 443
    edited 2007-12-19 15:59
    Nick Mueller said...
    What!? locals support the concept of scope.

    Sure. But scope within a subroutine. The idea is so that you can use the same labels in different subroutines, not to have multiple subroutines with the same name.

    I'd say the idea is to use global labels for the entry point, subroutine labels, and data, and locals for labels on jmps within subroutines.

    Of course when trying to squeeze something into 496 longs, things can sometimes get messier than that.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Help to build the Propeller wiki - propeller.wikispaces.com
    Play Defender - Propeller version of the classic game
    Prop Room Robotics - my web store for Roomba spare parts in the UK
Sign In or Register to comment.