Shop OBEX P1 Docs P2 Docs Learn Events
DAT file include question — Parallax Forums

DAT file include question

Cluso99Cluso99 Posts: 18,069
edited 2008-09-22 16:09 in Propeller 1
Has anyone used the DAT File command?

Since it does not appear to copy in pasm statements for compiling, what is it's use?? The manual is quite skimpy in this section.

I am trying to put the debug block of code (for my debugger) into a separate file that can be simply included into the users top level object.

Comments

  • CJCJ Posts: 470
    edited 2008-09-21 16:50
    I'm pretty sure it includes the file as binary data and doesn't do any further processing on it

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Parallax Forums - If you're ready to learn, we're ready to help.
  • BradCBradC Posts: 2,601
    edited 2008-09-21 17:19
    Absolutely correct. It simply imports a byte aligned binary blob.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Pull my finger!
  • Erik FriesenErik Friesen Posts: 1,071
    edited 2008-09-21 17:21
    It is straight in as far as I know. You can take a black and white bmp file and with a little juggling ouput it to an lcd or whatever.
  • Cluso99Cluso99 Posts: 18,069
    edited 2008-09-22 00:24
    Thanks guys. Can you tell me how to get a binary output from the compiler into this "file" input format ?
  • Mike GreenMike Green Posts: 23,101
    edited 2008-09-22 00:30
    You can use the binary output file from the compiler directly in a FILE statement. What you get in your new program is the entire binary file as a block of data. If that's not what you want, you will need to make your own program to extract the portions you want from the binary output file and copy them to another file which is what you include with the FILE statement.

    Note that there's an example from Chip of a Propeller loader that uses a FILE statement to include a complete binary output file that's used to download to another Propeller.
  • RaymanRayman Posts: 14,363
    edited 2008-09-22 00:46
    You could probably extract cog assembly code from the compilers binary output, like jazzed does for the ICC C compiler, and then include it with the FILE statement in order to load a cog with pre-build code...
  • Cluso99Cluso99 Posts: 18,069
    edited 2008-09-22 00:48
    Thanks Mike,
    That's exactly what I want. Hopefully the compiler will place it at the beginning. It is the debug block that must be in hub < $200. It makes it easier for users of my debugger to be able to just add a line in the DAT section of the top object to include the data. smile.gif
  • Cluso99Cluso99 Posts: 18,069
    edited 2008-09-22 13:36
    Disasterous. It doesn't do what I require. It has overhead byes and compiles to an address which is different when it is included with the file command. Oh well, at least I tried. Now I know the new compilers require a file include function (just imports source data).
  • hippyhippy Posts: 1,981
    edited 2008-09-22 14:10
    I'm not sure what "overhead bytes" you're seeing but I don't get any (*). What I'm seeing is what's in the file exactly as if it had been specified as a sequence of 'byte' commands, one byte per byte there is in the file used.

    Where it is placed seems to follow the same rules of DAT as usual, as if those 'byte' commands were placed where the FILE statement appears. I'll admit I only did limited testing. My FILE appeared immediately after the 'method link table' and before the first Spin method in the object it's used in just as DAT normally does.

    (*) Added : There may be some $00 padding added after FILE to make anything which follows word or long aligned as required.

    More added : Reading another thread it seems you may be using FILE "xxx.binary" in which case that will have all the prefix and postfix data bytes with the executable PASM which a normal Spin executable has. That's what was meant by having to run a utility to just strip out the bytes you need to create a file to use with the FILE command, or write your code which uses the FILE data to take that into account.

    Post Edited (hippy) : 9/22/2008 2:26:30 PM GMT
  • Cluso99Cluso99 Posts: 18,069
    edited 2008-09-22 16:09
    Thanks Hippy. Even stripping the bytes will not work as the code assembles (pasm) to a different location to where it then gets embedded. Yes, what I need is an #include.

    Anyway, I have just embedded the source in a demo file and that code will need to be cut and pasted into any user code. Just a restriction I can't get around. I've posted all the debuggers today - 3 in all. One does PASM and the other two do SPIN (optionally with pasm of the Interpreter on the fly) using different methods. One patches the Rom Interpreter on the fly, but it is more messy. The other loads two RamInterpreters and the user code must be in cog 7. The debugger is common to all 3 modes.
Sign In or Register to comment.