Shop OBEX P1 Docs P2 Docs Learn Events
Recovering code from stamp — Parallax Forums

Recovering code from stamp

jknoxjknox Posts: 9
edited 2010-07-31 07:30 in BASIC Stamp
Unfortunately I can't seem to get the forum·search to work with queries that contain more than one word. confused.gif

Is it possible to retrieve code from a Basic Stamp? I expect the short answer is 'no' but figured I would ask out of desperation.

It seems my source code did not make the transition with the rest of my data when my desktop got re-imaged. The only upside is that since the BS2 doesn't hold that much code the program wasn't too big. tongue.gif·The downside being I wrote it 11 months ago so I don't even remember how everything works.

At least I still have the pinouts listed on a whiteboard from way back then. I just need to remember how to change memory pages, deal with IO and LCD screens. [noparse];)[/noparse]

Comments

  • sylvie369sylvie369 Posts: 1,622
    edited 2010-07-30 20:33
    You will find that the answer is "no". Sorry. What's saved on the Stamp's EEPROM is not the text of your program.

    It sounds like a good opportunity to refresh your programming skills. Oh, and as soon as I learned that the automatic backup software on my external hard drive cannot be set to automatically backup Stamp and Spin source files, I made a new directory there and backed all of them up by hand, to avoid exactly the kind of situation you're in now.
  • jknoxjknox Posts: 9
    edited 2010-07-30 21:23
    Yeah it was just a stupid oversight - I didn't realize I had saved the files in the directory with the editor. I migrated all my data but not the program directories. <sigh>

    I know it is compiled code on the Stamp. I was just hoping there might be a reverse compiler. I wouldn't even mind if the variables were v1, v2, v3. The plus side is that it will probably be better code this time around. I just need to get out of the Flex/Java mindset I've been in the last few months and remember how the Stamp works.

    It wouldn't be a big deal normally except I needed to fix one bug on that old code in preperation for a trip next week. I have a PTU that I'm controlling with the Stamp and wanted to do some timelapse photography with motion while in Great Basin. That just means I'll have some serious coding to do over the next several evenings. ;^)

    The weather we have been having lately is more of a concern... I sure hope it clears up in time for the meteor showers.

    And this is just another example of the old proverb: There are two types of computer users: Those who have lost data and those who are about to lose data.

    Thanks for the reply.
  • Mike GreenMike Green Posts: 23,101
    edited 2010-07-30 21:53
    Unfortunately for you, there's no reverse compiler for Stamp bytecodes.

    As much as rewriting your program from scratch after nearly a year's absence will be a real pain, you will probably end up with a better program

    May it all work out and enjoy the showers.
  • APSpijkermanAPSpijkerman Posts: 32
    edited 2010-07-30 22:04
    When i was following the thread about how long a basic instruction
    takes i stumbled over a link about
    a guy who apparantly is able to recover code.
    But it is probably not that simple as that sounds.
    As he needs access to the stamp, and needs to do some work.

    http://home.earthlink.net/~parkiss/recovery.txt
  • jknoxjknox Posts: 9
    edited 2010-07-30 22:13
    I too expect the program will be much better this time around. The dusty brain cells are already starting to fire again. I remember one of the biggest problems I had in the first go around was figuring out how to use the code pages. Sitting here working on a different project one of those nuerons just fired off "Ping! The command you want to use is RUN." For some reason when I switched to the larger Basic Stamp it took me forever to find that. Just a case of not knowing what to ask for I guess.

    Buttons, LCD and serial IO should be easy enough given the examples in the book. I remember several nights having issues with the communications. I don't recall if that was on the PTU side or the Stamp side.

    Ah well, it will all come back to me. :^)
  • jknoxjknox Posts: 9
    edited 2010-07-30 22:18
    APSpijkerman said...
    When i was following the thread about how long a basic instruction
    takes i stumbled over a link about
    a guy who apparantly is able to recover code.
    But it is probably not that simple as that sounds.
    As he needs access to the stamp, and needs to do some work.

    http://home.earthlink.net/~parkiss/recovery.txt
    Oh cool, good info to know. If this were a commercial project I might be tempted to go that route. (Then again I would also be using SVN and if I still managed to lose the source I would probably be looking for a new job.) I didn't realize the Stamp tries to protect the program code. That is good to know as well.

    Thanks
  • Mike GreenMike Green Posts: 23,101
    edited 2010-07-30 22:40
    APSpijkerman,
    If it sounds too good to be true, it probably is ...

    There's really no way to recover all the contents of the EEPROM without an EEPROM reader and a hardware jig that makes contact with the pins of the EEPROM. The guy at the link you found may have the hardware needed. EEPROM programmers (readers) are not that hard to get and someone could build a jig to make the right contacts with the EEPROM, but it's not simple.

    Once you have the EEPROM contents, it's a lot of work to decode and there is no way to recover labels, variable names, or constant declarations. They simply don't exist in the EEPROM.
  • Martin_HMartin_H Posts: 4,051
    edited 2010-07-30 22:41
    If that fellow knows how to untokenize stamp code then he knows enough to write a Java version of the stamp tokenizer library.
  • FranklinFranklin Posts: 4,747
    edited 2010-07-30 23:51
    The older versions of the stamp editor (and maybe the new) store samples and programs in the program directory but vista and win 7 don't like that for users and their built in search does not look there by default. Software should use the users folder, either the actual user or the public user.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - Stephen
  • jknoxjknox Posts: 9
    edited 2010-07-30 23:56
    The old sysetm was on XP - thus the defualt directory was in the program directory. Rest assured version 2.0 won't be. ;^)
  • MoskogMoskog Posts: 554
    edited 2010-07-31 07:30
    I know this wont help you much with your problem today but for future projects its also a good ide to make a printout of your code.
    I use to collect everything in·ring binders, like pbasic code, drawings, pcb-layout, datasheets and all other kind of stuff for each project I'm working on.

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


    KjellO
Sign In or Register to comment.