Shop OBEX P1 Docs P2 Docs Learn Events
Address Operator — Parallax Forums

Address Operator

Carlos BastosCarlos Bastos Posts: 4
edited 2006-12-12 15:43 in BASIC Stamp
Hello,

Is there an operator to use as address operator, like "@".

An example:

x var byte
v var word

main:
v = @test
gosub test

end

test:
x = 2 + 62
return

I want that "v" receives the address of the code below test.

It's possible?

Thankz.

Comments

  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2006-12-12 15:21
    Carlos,
    ·
    ·· In PBASIC you can have a DATA statement and retrieve the address of the DATA statement by putting a label in front of it.· Then you can refer to that address by the label.· No @ symbol required.· I hope this helps.· Take care.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
  • Carlos BastosCarlos Bastos Posts: 4
    edited 2006-12-12 15:38
    Yeah Chris,

    I know that with DATA statement I can retrieve de address, but I wanna retrieve the address of portion of code, like
    GOSUB Someplace

    I need the address of "SomePlace" to save it in Scratch Pad RAM (like in the code fragment at previous post).

    If I can do it, then maybe it's possible I use this trick on my code to supply the Stamps technical difficulties.

    Thanks again.

    "Ah, if you cannot understand my poor write english, our apologies ..."
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2006-12-12 15:43
    Carlos,
    ·
    ·· I understand what you’re trying to do.· What I am offering is a work-around.· You can get back to a specific label in a given slot using the technique I described in the other thread (I just realized you have this going in two threads).· I can give you more detail if you like, but the concept is that you will need a variable as kind of a pointer to where you want to go when you get to a specific slot.· The address will be contained within the label name itself in the BRANCH instruction.


    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
Sign In or Register to comment.