Shop OBEX P1 Docs P2 Docs Learn Events
Pbasic Object Code — Parallax Forums

Pbasic Object Code

FlyingFishFingerFlyingFishFinger Posts: 461
edited 2006-12-11 01:07 in BASIC Stamp
Hello!
I'd like to be able to work with the tokens on the PC end. I'm not up to writing the whole thing for using the Tokenizer, so I thought I might me able to use the Object code feature of the Editor.
So, when I look at the .obj file with a text editor, I see all the introduction etc and then, after a couple lines of space the tokens.·But when I write a little program in QBasic to spit out the contents of the file, it only goes up to the last line of the text you can enter and gives me an "End of File". It never gets to the tokens.
Is there a workaround or do I have to use the Tokenizer?
Rafael

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
You've got to play the game.
You can't win.
You can't break even, except on a very cold day.
It doesn't get that cold.
~Laws of Thermodynamics~

Comments

  • FranklinFranklin Posts: 4,747
    edited 2006-12-09 04:17
    In binary (what the tokens are) the end of file character is a valid token. you need to use an editor that can read binary files.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - Stephen
  • Bruce BatesBruce Bates Posts: 3,045
    edited 2006-12-09 05:05
    What are you trying to accomplish?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    <!--StartFragment -->
  • FlyingFishFingerFlyingFishFinger Posts: 461
    edited 2006-12-09 05:24
    For a Science Fair project, remote reprogramming of the Stamp over the phone linesmile.gif

    Rafael

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    You've got to play the game.
    You can't win.
    You can't break even, except on a very cold day.
    It doesn't get that cold.
    ~Laws of Thermodynamics~
  • Bruce BatesBruce Bates Posts: 3,045
    edited 2006-12-09 09:32
    Rafael -

    You don't NEED to get into the object code, but I suppose that's one way to do it. In the end you're going to need to read the tokenizer documentation THOROUGHLY. What you have to realize is that there is a very explicit and reasonably rigid protocal used between the PBASIC IDE and the PBASIC Interpreter during programming. IF you are able to duplicate that, the rest of the problem is a good deal easier.

    The "Stache" programmer, offered by Tracy Allen, had to overcome just such problems before it became successful. You can read more about the "Stache" here:
    http://www.emesystems.com/stache.htm

    Regards,

    Bruce Bates

    Post Edited (Bruce Bates) : 12/9/2006 9:49:58 AM GMT
  • Sarten-XSarten-X Posts: 32
    edited 2006-12-09 10:07
    If all you're trying to do is deal with binary files, try:

    DIM A AS STRING * 1
    DIM Location AS LONG
    Location = 1
    OPEN "readme.txt" FOR BINARY AS #1
     DO UNTIL (EOF(1))
      GET #1, Location, A
      Location = Location + LEN(A)
      PRINT A;
     LOOP
    CLOSE #1
     
    

    This will pring out README.TXT, and ignore all the special characters. Or so it should... My QB abilities are a bit rusty.
  • FlyingFishFingerFlyingFishFinger Posts: 461
    edited 2006-12-09 18:01
    Bruce-
    I find that the Tokenizer is a little above my head. I figured out a way of doing it without crunching through the protocol documentation though. Basically, the Stamp sits on the phone line waiting for a call (no modem) and then it runs a program to write the recieved tokens to another slot (this only works with the slotted Stamps), which is then run.
    Sarten-X:
    Yeah, I figured out something similar yesterday. I put the GET in a for/next loop, so I can start reading where the object code starts, not from the beginning of the file. Thanks though.
    Rafael

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    You've got to play the game.
    You can't win.
    You can't break even, except on a very cold day.
    It doesn't get that cold.
    ~Laws of Thermodynamics~
  • FranklinFranklin Posts: 4,747
    edited 2006-12-09 19:27
    I'd like to see your schematic for the phone line connection. I could use something like that.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - Stephen
  • Bruce BatesBruce Bates Posts: 3,045
    edited 2006-12-09 21:51
    Rafael -

    You may be in real trouble if the tokenizer documentation is over your head. However, for what you want to do you really only need to study the handshake protocol, before data transfer, between the PBASIC IDE and the PBASIC Stamp, which is just a small part of the overall documentation.

    Regards,

    Bruce Bates

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    <!--StartFragment -->
  • FlyingFishFingerFlyingFishFinger Posts: 461
    edited 2006-12-10 00:40
    Stephen- There is a Nuts&Volts article that contains the circuit I used. I believe it is #19.

    Bruce-
    I don't follow. The code gets compiled at the user end, then I dismantle the object file, transmit the tokens over the line and write·them to another slot. I don't see any need to study the programming protocol...unless I'm missing something major? As far as I can tell, the memory map contains exactly the tokens that are in the object file, so I can just write them in from another slot. I've transferred programs from one slot to another without problems...

    Rafael

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    You've got to play the game.
    You can't win.
    You can't break even, except on a very cold day.
    It doesn't get that cold.
    ~Laws of Thermodynamics~
  • FlyingFishFingerFlyingFishFinger Posts: 461
    edited 2006-12-10 00:56
    Aaah...you got me. The tokens in the object file aren't the same.

    Rafael

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    You've got to play the game.
    You can't win.
    You can't break even, except on a very cold day.
    It doesn't get that cold.
    ~Laws of Thermodynamics~

    Post Edited (FlyingFishFinger) : 12/10/2006 1:20:11 AM GMT
  • Bruce BatesBruce Bates Posts: 3,045
    edited 2006-12-10 07:26
    Rafael -

    As I said at the outset, I wasn't considering using the object file.

    Regards,

    Bruce Bates

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    <!--StartFragment -->
  • FlyingFishFingerFlyingFishFinger Posts: 461
    edited 2006-12-11 01:07
    Okay, so that won't work.
    I've reread the Tokenizer documentation, and I guess I'll have to give that a try.
    Is it possible to write a compiling program with QuickBasic using the Library? If it is, I'm going to need some help getting it going.
    Thanks for any info

    Rafael




    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    You've got to play the game.
    You can't win.
    You can't break even, except on a very cold day.
    It doesn't get that cold.
    ~Laws of Thermodynamics~
Sign In or Register to comment.