A92: Re: About Bin files.


[Prev][Next][Index][Thread]

A92: Re: About Bin files.




>
>Hello.
>Can anyone tell me out to use bin files ?
>How to create them ?
>What do they contain ?
>In fact, I don't know much ( nothing ) about these files you can include
>INCBIN ) in your Fargo Program.
>I would like to know everything about these.
>( For example, in Ghell. The Fargo program which is a Doom-Like. There is a
>bin file. How is it used ? etc...).
>


Okay, first...  BIN files can be ANYTHING!  They are simply binary
files.  When you do an INCBIN, it puts the actual binary data in
the program at that location in the program.  The binary in Ghell
is probably picture data and map data.  The data is the same as
doing "dc.b".  Using it simply requires have a LABEL to reference
it by.  If the binary data is assembled assembler (machine code),
you can actually BRAnch to it.

>
>ANOTHER THING ( I know, it makes a lot in one Post ).
>
>How can i Create a file ( of any type ) while running a prog.
>I read a lot about the way these files are stored in the memory ( Handles,
>the way they are described, etc...), but I don't know how to create one
>while the prog is running.
>


File creation is pretty easy.  You need to allocate the space
and use handles.  You need handles so that the TIOS can locate
the file in the proper folder.  The docs explain that, and I
believe there are routines in the docs that can be used.

Every file is exactly the same structure.  It's a word for the
file size followed by the data.  At the end of the file, there
is a token identifying the file type.  There is a list of file
types in the docs.  It depends on what type of file you are
planning on creating.  But the docs explain the format for
almost all of the file types.  If you are simply making a file
that your program uses exclusivly (using a string to store
scores, etc.), it doesn't matter what file type you use.  But
be careful, if the TIOS tries to interpret the file based on
a file token you use and the data doesn't match, you may cause
the OS to crash, or the file will be rewritten properly hence
corrupting your data.  (This is the case when editing a FARGO
program... TIOS tries to retokenize and doesn't know about the
assembler code...)

====
Aaron Hill (Redmond, WA)
E-mail: SeracOhw24@msn.com
IRC Nick: SeracOhw (EF-Net)