Shop OBEX P1 Docs P2 Docs Learn Events
Getting Code off Stamp — Parallax Forums

Getting Code off Stamp

ArchiverArchiver Posts: 46,084
edited 2004-04-23 00:43 in General Discussion
I have unfortunately lost my text file containing my program on for
the Basic Stamp II. However, the code I want is currently loaded on
my Stamp. I was wondering if there is a way to get the code off the
Stamp so I can somehow view it in the Stamp Editor.

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2004-04-22 03:00
    If ever we make an FAQ, THIS question will be
    AT THE TOP. I've been here a year, now, and
    every 6 weeks or so someone asks this question.
    This very question. This SAME question.

    The answer is basically no, your program is
    stored as PBasic tokens on the EEPROM, and
    there is no way to get the PBasic source
    back again. Search the archives for a more
    thorough answer.

    -- In basicstamps@yahoogroups.com, "longngo" <longngo@y...> wrote:
    > I have unfortunately lost my text file containing my program on for
    > the Basic Stamp II. However, the code I want is currently loaded on
    > my Stamp. I was wondering if there is a way to get the code off the
    > Stamp so I can somehow view it in the Stamp Editor.
  • ArchiverArchiver Posts: 46,084
    edited 2004-04-22 04:06
    --- In basicstamps@yahoogroups.com, "longngo" <longngo@y...> wrote:
    > I have unfortunately lost my text file containing my program on for
    > the Basic Stamp II. However, the code I want is currently loaded on
    > my Stamp. I was wondering if there is a way to get the code off the
    > Stamp so I can somehow view it in the Stamp Editor.

    There is one thin ray of hope. You can get the pcode from the chip.
    After that, you can analyze the pcode to determine the logic and
    operational sequence of the program and use it as a guide in
    reconstructing the original Basic code. This will be a tedious task;
    even more so if you don't have a very deep understanding of how
    higher level languages are translated into intermediate code or
    machine code. But it is doable.

    The reconstruction process may be easier for the original author, who
    might have recollections about the general structure, than it would
    be for someone with no previous exposure to the code.

    You will probably want to write a pcode disassembler which will make
    the pcode easier to peruse. The link below has information that will
    help you understand Stamp pcode.

    http://www.mcmanis.com/chuck/Robotics/stamp-decode.html
  • ArchiverArchiver Posts: 46,084
    edited 2004-04-22 14:05
    --- In basicstamps@yahoogroups.com, "Don Kinzer" <dkinzer@e...> wrote:
    > --- In basicstamps@yahoogroups.com, "longngo" <longngo@y...> wrote:
    > > I have unfortunately lost my text file containing my program on
    for
    > > the Basic Stamp II. However, the code I want is currently loaded
    on
    > > my Stamp. I was wondering if there is a way to get the code off
    the
    > > Stamp so I can somehow view it in the Stamp Editor.
    >
    > There is one thin ray of hope. You can get the pcode from the
    chip.
    > After that, you can analyze the pcode to determine the logic and
    > operational sequence of the program and use it as a guide in
    > reconstructing the original Basic code. This will be a tedious
    task;
    > even more so if you don't have a very deep understanding of how
    > higher level languages are translated into intermediate code or
    > machine code. But it is doable.
    >
    > The reconstruction process may be easier for the original author,
    who
    > might have recollections about the general structure, than it would
    > be for someone with no previous exposure to the code.
    >
    > You will probably want to write a pcode disassembler which will
    make
    > the pcode easier to peruse. The link below has information that
    will
    > help you understand Stamp pcode.
    >
    > http://www.mcmanis.com/chuck/Robotics/stamp-decode.html


    As a warning, for someone with no knowledge, this might appear
    similar to scraping all the ink from a page and then trying to figure
    out what the page was all about.

    But, as you probably hear all the time, save your work.

    One of the best things you can do is go out and buy a 3 ring note
    book and plastic page savers (heavy duty) and print out each program
    and stick it in the book. Copy the program on a Disk and put that
    disk in the book too.

    For an on-going project, it is better to have a small binder and to
    double space the code and then pen in your changes.

    One word of caution, is that programmers who sell code will often put
    in dummy fields so as to make it very hard for someone to backwards
    engineeer the code.

    I would venture to guess that it will be much easier to re-write the
    program than to decipher the existing code. One reason is that as
    you re-write it, most of it will come back quickly and you will not
    be making many of the start-up mistakes.

    Dave
  • ArchiverArchiver Posts: 46,084
    edited 2004-04-22 14:09
    Right, but be aware: The attached web-page describes
    the BS1 stamp -- NOT the BS2. The BS2 does NOT
    create the '.OBJ' file he mentions, and the
    BS2 PBasic is a bit more sophisticated than the
    BS1 PBasic -- I think.

    So, you still don't have the *.OBJ file -- your
    PCode is in the EEPROM. Good luck.

    --- In basicstamps@yahoogroups.com, "Don Kinzer" <dkinzer@e...> wrote:
    > --- In basicstamps@yahoogroups.com, "longngo" <longngo@y...> wrote:
    > > I have unfortunately lost my text file containing my program on
    for
    > > the Basic Stamp II. However, the code I want is currently loaded
    on
    > > my Stamp. I was wondering if there is a way to get the code off
    the
    > > Stamp so I can somehow view it in the Stamp Editor.
    >
    > There is one thin ray of hope. You can get the pcode from the
    chip.
    > After that, you can analyze the pcode to determine the logic and
    > operational sequence of the program and use it as a guide in
    > reconstructing the original Basic code. This will be a tedious
    task;
    > even more so if you don't have a very deep understanding of how
    > higher level languages are translated into intermediate code or
    > machine code. But it is doable.
    >
    > The reconstruction process may be easier for the original author,
    who
    > might have recollections about the general structure, than it would
    > be for someone with no previous exposure to the code.
    >
    > You will probably want to write a pcode disassembler which will
    make
    > the pcode easier to peruse. The link below has information that
    will
    > help you understand Stamp pcode.
    >
    > http://www.mcmanis.com/chuck/Robotics/stamp-decode.html
  • ArchiverArchiver Posts: 46,084
    edited 2004-04-22 15:50
    No; the code in your Stamp module is in a compiled format. Even if you
    could retrieve the tokens, there is no way to restore your original text
    file from them. Hopefully, you wrote the program and can recreate it
    accurately based on the BASIC Stamp's behavior. Who knows ... you may
    even improve the program.

    -- Jon Williams
    -- Applications Engineer, Parallax
    -- Dallas Office



    Original Message
    From: longngo [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=aJ5lB3r2WYJqoNjkjHuQvWVlEmqop8CHMGXYbzxBGrGh8FrlYQ3k1vfmIlgsZBWzho9EFcTNzn6ljg]longngo@y...[/url
    Sent: Wednesday, April 21, 2004 8:02 PM
    To: basicstamps@yahoogroups.com
    Subject: [noparse][[/noparse]basicstamps] Getting Code off Stamp


    I have unfortunately lost my text file containing my program on for
    the Basic Stamp II. However, the code I want is currently loaded on
    my Stamp. I was wondering if there is a way to get the code off the
    Stamp so I can somehow view it in the Stamp Editor.
  • ArchiverArchiver Posts: 46,084
    edited 2004-04-23 00:43
    Here's one solution:

    http://home.earthlink.net/~parkiss/recovery.txt

    Regards,

    Steve


    On 22 Apr 04 at 1:01, longngo wrote:

    > ...I was wondering if there is a way to get the code off the
    > Stamp so I can somehow view it in the Stamp Editor.
Sign In or Register to comment.