Shop OBEX P1 Docs P2 Docs Learn Events
Is there a possibility for something like: JMP #$+4 ($=actual adress in cog ram — Parallax Forums

Is there a possibility for something like: JMP #$+4 ($=actual adress in cog ram

Christof Eb.Christof Eb. Posts: 1,161
edited 2007-09-21 01:19 in Propeller 1
Has anyone seen a possibility to write something like:
JMP #$+4 ($=actual adress in cog ram or in main ram.)?

Many thanks for some input!
Christof

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2007-03-21 20:17
    The symbol "$" does not exist and there is no equivalent.· In assembly you can use an expression as the destination of a jump instruction like [noparse][[/noparse]code]
    ···· djnz·· count,#:start+3
    [noparse][[/noparse]/code]
    In some circumstances, you might be able to use local labels (":start" for example) instead of the "here" operand ("$").· Some compilers get around the lack of a "here" operand by generating conventional labels like "L0001".· In the case of Spin, you could use a combination of local labels and generated labels ... You could start the renumbering over again in every C function and use ":L0001" through ":L9999".

    ·
  • TransistorToasterTransistorToaster Posts: 149
    edited 2007-03-21 20:31
    Christof,
    What is the main goal of what you are trying to implement?

    BTW,the jump instruction can be used without the # such that the jump reg will go to the address contained in reg.
  • Jeff MartinJeff Martin Posts: 756
    edited 2007-03-21 21:42
    I'm assuming you are debugging by stopping your code at a specific point.

    I always use something like:

      :here                     jmp     #:here
    
    

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    --Jeff Martin

    · Sr. Software Engineer
    · Parallax, Inc.
  • Christof Eb.Christof Eb. Posts: 1,161
    edited 2007-03-24 08:31
    Thank you for your input.

    I'm working on the SmallC Compiler and it would have been a possibility to get the compiler to pass long literals to the assembler, if there had been a thing like "$" in this assembler.
    Sorry for not having been clear.

    Christof
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2007-03-24 16:50
    This is definitely something the assembler needs. The need will become even more acute once macros are introduced, since a "here" symbol is so much cleaner than a splattering of temporary labels within macro expansions. Every other assembler I've ever worked with has had a "here" symbol, so I suspect we'll see one for the Propeller sooner or later.

    -Phil
  • cgraceycgracey Posts: 14,133
    edited 2007-03-24 17:02
    I will try to add this to the compiler today. I like the idea of '$' to mean current origin. I think it will just be a matter of making the parser check for a non-hex-digit after a $, and then pass a special token.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔


    Chip Gracey
    Parallax, Inc.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2007-03-24 17:07
    Thanks, Chip!

    Update: Oh, by the way, in some assemblers the "here" symbol refers to the instruction containing it; in others, to the next instruction. Even though it's confusing having two standards floating around, there's no compelling reason to pick one over the other.

    In either case, the expression "$-$" makes a nice bold indicator for source or destination values that get filled in during execution. I've used "0-0" up until now.

    -Phil

    Post Edited (Phil Pilgrim (PhiPi)) : 3/24/2007 5:22:42 PM GMT
  • cgraceycgracey Posts: 14,133
    edited 2007-03-24 20:12
    Well, I just used "$" to indicate the current origin of the instruction being assembled, so "JMP #$" creates a one-instruction loop. Of course, you can do "$+1" or "$-1" to indicate the next or previous cog·address.

    I just got this done and Jeff is going to compile it into the Propeller.exe when he gets back from lunch, so we should have a new version posted on this thread in a few hours.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔


    Chip Gracey
    Parallax, Inc.
  • cgraceycgracey Posts: 14,133
    edited 2007-03-24 20:28
    Jeff just sent this to me and it checks out fine. Remember to change the .ex_ extension to .exe after downloading.

    Now you can use $ in DAT declarations to say 'here' within the cog.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔


    Chip Gracey
    Parallax, Inc.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2007-03-24 20:49
    Wow, that's fast service! Thanks again!

    -Phil
  • SapiehaSapieha Posts: 2,964
    edited 2007-09-20 15:36
    Hi Chip

    Thanks for ny version av Propeller Tools.
    But still not manual Com port settings.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Nothing is impossible, there are only different degrees of difficulty.

    Sapieha
  • hippyhippy Posts: 1,981
    edited 2007-09-20 16:09
    Chip Gracey (Parallax) said...
    Now you can use $ in DAT declarations to say 'here' within the cog.

    Many thanks. That's a welcomed addition, and you chose the exact token I prefer smile.gif
  • Fred HawkinsFred Hawkins Posts: 997
    edited 2007-09-20 16:50
    Did this embellishment get into Prop Tool 1.05.5?

    edit: is 1.05.05 the latest tool? And is there a history file that notes changes/updates that has been shared?

    Post Edited (Fred Hawkins) : 9/20/2007 4:55:13 PM GMT
  • BradCBradC Posts: 2,601
    edited 2007-09-20 17:01
    Given the thread is 6 months old, I'd hope it did, however a quick test shows

    jmp #$

    Gives the error "Invalid Hex Number"
    [noparse][[/noparse]edit] The .exe in the post above gives me version 1.05.6 .. so no..
  • Jeff MartinJeff Martin Posts: 756
    edited 2007-09-20 17:26
    Hi,

    The v1.05.6 posted in this thread supports that feature. The web site wasn't updated though (still have v1.05.5). I've taken care of it and it should be posted to the web in a few minutes.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    --Jeff Martin

    · Sr. Software Engineer
    · Parallax, Inc.
  • Fred HawkinsFred Hawkins Posts: 997
    edited 2007-09-20 20:21
    Hippy,

    Thanks for unearthing this today. $ got overlooked by the mainstream here -- I think my first post here was just about this thing, with the same label answer.

    Fred

    edit: Does one uninstall the 1.05.5 before installing this one? Or will it just overwrite?

    Post Edited (Fred Hawkins) : 9/20/2007 8:53:35 PM GMT
  • Paul BakerPaul Baker Posts: 6,351
    edited 2007-09-20 21:36
    They will be installed to two differently named directories so you do not need to uninstal the previous version.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Paul Baker
    Propeller Applications Engineer

    Parallax, Inc.
  • BradCBradC Posts: 2,601
    edited 2007-09-20 22:28
    I note the version posted above is 1.05.6 and the version on the web page is 1.05.7.. anything else changed in there we might want to know about? No hidden flight simulators or something?
  • hippyhippy Posts: 1,981
    edited 2007-09-21 00:24
    @ Fred : It's really Sapieha who takes the credit for putting it back in the limelight and exposing the fact it never made it to public release. TBH, I never even looked at the date of the first post - and all dates 'over there' are confusing for us Europeans anyway smile.gif
  • Fred HawkinsFred Hawkins Posts: 997
    edited 2007-09-21 01:19
    aha. His was a dark blue post which my geezer eyes ignored.

    Sapieha, thanks.

    Edit:

    So Brad's query doesn't get ignored:

    What's up with 1.05.7 version (which one further than this thread's)?
Sign In or Register to comment.