Shop OBEX P1 Docs P2 Docs Learn Events
Retrieving a BAS program — Parallax Forums

Retrieving a BAS program

dazedandconfuseddazedandconfused Posts: 4
edited 2014-02-23 16:21 in General Discussion
I have a program resident in my BS2, but I cannot find the file on my PC hard drive.
Is there a way to “pull” the program off the BS2 and get the BS2 file back on my hard drive?
Thank you!

Comments

  • JonnyMacJonnyMac Posts: 9,107
    edited 2014-02-22 09:05
    No. The BASIC Stamp editor compiles your source file into compressed bytecodes that are run by the BS2 interpreter. Even if you read the EEPROM contents (which would require removing it from the BS2), you'd see nothing that resembles your original source.

    This is where the phrase, "Save early; save often." comes from.
  • dazedandconfuseddazedandconfused Posts: 4
    edited 2014-02-22 09:25
    Thank you JonnyMac.
    Fortunately, I found a hardcopy, so I did a copy/paste into the editor.
  • GadgetmanGadgetman Posts: 2,436
    edited 2014-02-22 09:35
    This is a question that has been asked a few times before...

    In theory, you could read out the EEPROM using another BS2.
    But then you' have to decode the tokens...

    I think someone once managed to decode them, but it was a lot of work...
    (The tokens are not all the same size for one thing, and different instructions is encoded into different number of tokens)
    So the end result (if you're ever successful... ) will not look anything like the original.

    I think there's a book that describes the tokens, but can't remember the name.
    Doesn't really matter as the last time I saw it on Amazon, it was pretty expensive...
  • JonnyMacJonnyMac Posts: 9,107
    edited 2014-02-22 11:27
    "Inside the BASIC Stamp II" by Brian Forbes.

    http://www.amazon.com/Inside-BASIC-Stamp-Brian-Forbes/dp/B00BQ0GCPU/ref=sr_1_1?ie=UTF8&qid=1393097198&sr=8-1&keywords=inside+the+basic+stamp

    For some reason, I have two copies on my shelf. Would be willing to let go of one for $20 and postage.
  • trookstrooks Posts: 228
    edited 2014-02-23 16:21
    Gadgetman wrote: »
    This is a question that has been asked a few times before...

    In theory, you could read out the EEPROM using another BS2.
    But then you' have to decode the tokens...

    I think someone once managed to decode them, but it was a lot of work...
    (The tokens are not all the same size for one thing, and different instructions is encoded into different number of tokens)
    So the end result (if you're ever successful... ) will not look anything like the original.

    I think there's a book that describes the tokens, but can't remember the name.
    Doesn't really matter as the last time I saw it on Amazon, it was pretty expensive...


    AT one time I could read Basic code from a core dump to printer. What you need is a PRM for the PIC16F57 chip.

    If I knew where to look there probably is a decompiler out in the ether.


    Tim
Sign In or Register to comment.